KEYWORDS USED IN C PROGRAMMING.
1.auto
This declares automatic variables. For example:
auto int var1;
This statement suggests that var1 is a variable of storage class auto and type int.
2.break and continue
The break statement terminates the innermost loop immediately when it’s encountered.
The continue statement skips the statements after it inside the loop for the iteration.
for (i=1;i<=10;++i){
if (i==3)
continue;
if (i==7)
break;
printf("%d ",i);
}
4.switch, case and default
The switch and case statement is used when a block of statements has to be executed among many blocks. For example:
switch(expression)
{
case '1':
//some statements to execute when 1
break;
case '5':
//some statements to execute when 5
break;
default:
//some statements to execute when default;
}
5.char
This declares a character variable.
6.const
This declares an identifier a constant.
const int a = 5;
7.do….while
8.double and float
Double and float are used for declaring floating type variables. For example:
float number;
double longNumber;
9.if and else
In C programming, if and else are used to make decisions.
if (i == 1)
printf("i is 1.")
else
printf("i is not 1.")
If the value of i is other than 1, the output will be :
i is not 1
10.enum
Enumeration types are declared in C programming using keyword enum.
11.extern
Extern declares that a variable or a function has external linkage outside of the file it is declared.
12.for
There are three types of loops in C programming. The for loop is written in C programming using the keyword
13.goto
This is used to transfer control of the program to the specified label. For example:
for(i=1; i<5; ++i)
{
if (i==10)
goto error;
}
printf("i is not 10");
error:
printf("Error, count cannot be 10.");
14.int
This is used to declare integer type variables.
15.short, long, signed and unsigned
The short, long, signed and unsigned keywords are type modifiers that alter the meaning of a base data type to yield a new type.
16.return
The return keyword terminates the function and returns the value.
int func() {
int b = 5;
return b;
}
17.sizeof
The size of keyword evaluates the size of data.
18.register
The register keyword creates register variables which are much faster than normal variables.
19.static
The static keyword creates a static variable. The value of the static variables persists until the end of the program.
20.struct
The struct keyword is used for declaring a structure. A structure can hold variables of different types under a single name.
struct student{
char name[80];
float marks;
int age;
}s1, s2;
21.typedef
The typedef keyword is used to explicitly associate a type with an identifier.
22.union
A union is used for grouping different types of variables under a single name.
23.void
The void keyword meaning nothing or no value
24.volatile
The volatile keyword is used for creating volatile objects. A volatile object can be modified in