Beruflich Dokumente
Kultur Dokumente
Array of pointers - Just like we can declare an array of int, float or char etc, we can also declare an
array of pointers, here is the syntax to do the same.
Syntax: datatype *array_name[size];
Datatype - In the C programming language, data types are declarations for memory locations or
variables that determine the characteristics of the data that may be stored and the methods
(operations) of processing that are permitted involving them.
Constant - Constants refers to the fixed values that do not change during the execution of a program.
A "constant" is a number, character, or character string that can be used as a value in a program.
Use constants to represent floating-point, integer, enumeration, or character values that cannot be
modified. C supports several types of constants
Keywords - Keywords are predefined, reserved words used in programming that have special
meanings to the compiler. Keywords are part of the syntax and they cannot be used as an identifier.
For example
int money;
Here, int is a keyword that indicates 'money' is a variable of type integer.
As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all
keywords allowed in ANSI C.
Keywords in C Language
auto, double, int, struct, break, else, long, switch, case, enum, register , typedef, char, extern, return,
union, continue , for, signed, void, do, if, static , while, default, goto, sizeof, volatile, const, float,
short, unsigned
Along with these keywords, C supports other numerous keywords depending upon the compiler.
List of keywords in C programming language
Character set
Character set is a set of alphabets, letters and some special characters that are valid in C language.
Alphabets
Uppercase: A B C ................................... X Y Z
Lowercase: a b c ...................................... x y z
C accepts both lowercase and uppercase alphabets as variables and functions.
Digits
0123456789
Special Characters in C Programming
,<>._();$:%[]#?' &{}"^ !*/|-\~+
White space Characters
blank space, new line, horizontal tab, carriage return and form feed
Identifiers - Identifier refers to name given to entities such as variables, functions, structures etc.
Identifier must be unique. They are created to give unique name to a entity to identify it during the
execution of the program. For example:
int money;
double accountBalance;
Here, money and accountBalance are identifiers.
Rules for writing an identifier
1. A valid identifier can have letters (both uppercase and lowercase letters), digits and
underscores.
2. The first letter of an identifier should be either a letter or an underscore. However, it is
discouraged to start an identifier name with an underscore.
3. There is no rule on length of an identifier. However, the first 31 characters of identifiers are
discriminated by the compiler.
A function declaration tells the compiler about a function's name, return type, and parameters. A
function definition provides the actual body of the function.
Loop - a loop is a sequence of instruction s that is continually repeated until a certain condition is
reached. Typically, a certain process is done, such as getting an item of data and changing it, and
then some condition is checked such as whether a counter has reached a prescribed number.
While loop - A while loop in C programming repeatedly executes a target statement as long as a
given condition is true.
Syntax
while(condition)
{
statement(s);
}
For loop - A for loop is a repetition control structure that allows you to efficiently write a loop that
needs to execute a specific number of times.
Syntax
for ( init; condition; increment )
{
statement(s);
}
Do while loop - Unlike for and while loops, which test the loop condition at the top of the loop,
the do...while loop in C programming checks its condition at the bottom of the loop.
A do...while loop is similar to a while loop, except the fact that it is guaranteed to execute at least one
time.
Syntax
do
{
statement(s);
} while( condition );
Nested loop - C programming allows to use one loop inside another loop.
Nested for loop syntax Nested while loop syntax Nested do while syntax
for ( init; condition; increment ) { while(condition) { do {
statement(s);
for ( init; condition; increment ) { while(condition) {
statement(s); statement(s); do {
} } statement(s);
statement(s); statement(s); }while( condition );
} }
}while( condition );