What is Keywords in C ? | C programming language

Keywords

keywords are the reserved words which a predefined meaning in any programming language. C programming language also have 32 keywords . The meaning of these keywords also have been described to c compilers and the meaning of these keywords can not be changed. 

A keyword is a sequence of characters that the C compiler readily accepts and recognizes while being used in a program. Note that the keywords are all lowercase. Since uppercase and lowercase characters are not equivalent, it is possible to utilize an uppercase keyword as an identifier.




Following are the keywords in c programming language



Rules for keywords

  • By convention all keywords must be written in lower case(small) letters.
  • Keywords can not be used as a variable names because that would try to change the existing meaning of the keywords which os not allowed.

Here is an example of keywords in C language,

Example

#include <stdio.h>
int main() {
   // char, int and float are keywords and used as datatypes
   char c = 'H';
   int b = 6, c;
   float _d = 7.6;
   // if and else is a keyword checking the value of b
   if(b<5)
   printf("Character Value : %c",a1);
   else
   printf("Float value : %f",_d);
   return 0;
}

Output

Float value : 7.600000

Post a Comment

0 Comments