C programming keywords and identifiers

As we saw in a simple program of C in the previous chapter, there are various words, letters and digits. Every word used in a C program is classified either as a Keyword or an Identifier. So in this tutorial you will learn about c programming keywords and identifiers.

c programming keywords and identifiers

C Programming Keywords


All the words used in C program which have fixed predefined meaning and whose meanings can’t be changed by the users are termed as Keywords. There are fixed number of keywords in C programming language and every keyword serves as a building block for program statements.

List of Keywords of ANSI C

auto double int struct
char extern return union
break else long switch
case enum register typedef
const float short unsigned
continue for signed void
do if static while
default goto sizeof volatile

 

Note: Since C is a case sensitive programming language all the keywords must be written in lowercase.

[adsense1]

C Programming Identifiers


In the real world, when a new baby is born a name is given. Similarly, in C program when a new variable, function or an array is declared a particular name is given to them which is called an identifier. For example

int apple;

Here, apple is an identifier of  integer type variable.

So identifiers are the user defined names. However, there are certain rules that must be followed while writing an identifier.

Good Programming Practice
While writing variable name use the meaningful word which makes a program self-documenting. For example: totalMoney

 

Common programming error
Using first letter in uppercase where lowercase should be used.

 

Rules for writing an identifier


  • First letter of an identifier must be alphabet (underscore is also allowed)
  • Identifier can only contain letters, digits and underscores
  • Maximum length of identifier allowed is 31 characters
  • White space is not allowed
  • Keywords cannot be used as identifier