Keywords and Identifiers in C Programming


Keywords are the reserved words used in programming. Each keywords has fixed meaning and that cannot be changed by user. All keywords must be written in lowercase. .

Here is the list of all keywords predefined by ANSI C

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


"Identifiers" or "symbols" are the names you supply for variables, types, functions, and labels in your program. Identifier names must differ in spelling and case from any keywords.

You cannot use keywords as identifiers; they are reserved for special use. You create an identifier by specifying it in the declaration of a variable, type, or function.

    #include <stdio.h>
    int main()
    int final_result;
    if ( final_result != 0 )
        printf_s( "Bad file handle\n" );

In the example above, final_result is an identifier for an integer variable, and main and printf are identifier names for functions.

Once declared, you can use the identifier in later program statements to refer to the associated value.

Rules for writing identifier

  1. An identifier can be composed of letters (both upper case and lower case letters), digits and underscore '_' only.
  2. The first letter of identifier should be either a letter or an underscore. But, it is discouraged to start an identifier name with an underscore though it is legal. It is because, identifier that starts with underscore can conflict with system names. In such cases, compiler will complain about it. Some system names that start with underscore are _fileno, _iob, _wfopen etc.
  3. There is no rule for the length of an identifier. However, the first 31 characters of an identifier are discriminated by the compiler. So, the first 31 letters of two identifiers in a program should be different.

Ads Right