Keywords in C

  • They are an essential part of a language definition they implement specific features of the language
  • These are some special words that have a predefined meaning for the C compiler. Hence, these words cannot be used as identifiers.
  • These are a set of words that are reserved for certain operations and hence are also sometimes referred to as reserved words.
  • All are in lower case.
  • All have fixed meanings and these meanings cannot be changed
  • They serve as basic building blocks from program statements
  • They will be used in different places in programming
  • These keywords include all those keywords also as declared by ANSI(American National Standards Institute) C.This institute has published the standard to be used in C programming language.

The Following are The Keywords Of C :

keywords
keywords in C
auto: auto keyword is used to specifies that variable which is declared will be automatically take away from its initializer
else: The if statement executes the statement if the condition is true. If the condition is not true then it will execute the else statement
enum: Enumerated types of work when you know in advance a finite(usually short) list of values that a data type can take on The keyword “enum” is used to declare an enumeration
break: break keyword is an exit from a loop, just as it does from a switch statement
extern: this keyword tells the compiler that variable is declared outside the module, then the linker find this actual declaration and setup the extern variable and point to the correct location.
case: for a variable to be tested against a list of values, where each value is called “case“.  and the variable being switched on is checked for each case.
float: float represent numbers with decimal place– like 8.225466,0.15266 and -10.2
register: This is advising the compiler to store the data in the CPU register instead of memory
typedef: It is used to simplify the syntax of declaring a complex data structure consist of struct and union types
char: char is short for the character, which is a data type that holds one character
for:
for keyword is used under the loop control system, where it executes on satisfying the condition
return: The return statement stops execution and returns to the calling function.
union: union is a collection of multiple data elements that can be of different data types
const: The keyword const stands for Constant.it is used to make the value constant throughout the program
goto: goto statement transfers the control to the label specified with the goto statement
short: It is used to declare a short integer variable, where the type short occupies two bytes and important point is used to save memory
unsigned: It is used to declare an unsigned integer.it makes variable represent only natural number
if: Execute the code based on the if condition
signed: All integer data types are signed data types, which can have value positive or negative
continue: The continue statement also neglects the statements after it in the loop and transfers the control back to the starting of the loop for the next iteration
sizeof: This keyword used to get the size of a data type such as union, structure, or any other user-defined data types
default: This keyword is used when the value of the loop variable doesn’t match any of the case constant
int: It is used to declare integer variable
static: It is used to give special characteristics to an element.Static has a scope until the program’s lifetime.
void: void represent that function or method doesn’t have a return type
long: It is used to declare a long integer variable, where the size of the data type “long” is not fixed
volatile:Tells the compiler that the variable may be changed at any time, without changing the code
do: The keyword do mark the beginning of the loop
struct: struct keyword is used to define the structure data type where the collection of different data can be stored
double: This keyword used to define numeric variables holding numbers with decimal points.
switch: It is used to execute a variable having different possible value
while: It is used to evaluate the test expression

For Example :

#include<stdio.h>
#include<conio.h>
int main()
{
int i;
for(i=0;i<8;i++)
{
if(i%2==0)
printf("%d\n",i+1);
else 
if(i%3==0)
continue;
else
if(i%5==0)
break;
printf("\nEnd of Program\n");
}
printf("\nEnd of program\n");
}

OUTPUT:
1
End of Program
3
End of Program
5
End of Program
End of Program
Translate »