C Keywords and Identifiers

C Identifier

Identifiers are the names that are given to the various program elements such as functions, variables, union, structure and  arrays. It must be unique. They are created to give a unique name to an entity to identify it during the execution time of the program.

There are some rules for constructing identifiers:

  • The first character of an identifier must be an alphabet or underscore. For example:
int code; 
int _code; 

Both are valid identifiers in C language.

  • The identifier name must not start with a digit. Which means we are not allowed to declare a variable name  starts with the digit. For example :
int 0codiens;

It will raise an error, because the C compiler does not allow us to define an identifier which starts from a digit.

  • The identifier name must not be a keyword of language. For example:
int char;

In this case char is a keyword of C language so this is invalid declaration.

  • The identifier name must avoid white spaces. For example :
int co de;

The given identifier is invalid because the C compiler does not allow us to define an identifier with the white space.

  • C identifiers are case sensitive that means lowercase and uppercase are distinct. For example :
int a=10;
int A=10;

Here, a and A are not the same.both are stored in different memory locations.

An identifier can be long, Some implementations of C language recognize only the first 8 characters though most implementations recognize more( around 31 characters).

The ANSI( American national standard institute) suggests we make an identifier with 15 to 20 characters maximum but this is not necessary. Additional characters are carried along for the programmer’s convenience.

C Keywords

Keywords are reserved words of programming languages. The meaning of these words  has already been explained to the C compiler. So that’s why we can’t use these words as an identifier or a variable name.

Every word in C program is classified as either a keyword or an identifier or an operator.

keyword in C is a sequence of characters that the C compiler accepts and recognizes while being used in the program. In C programming, all keywords are in lowercase.

Since  lowercase and uppercase characters are not equivalent, We can use an uppercase word as an identifier which is similar to any C keyword.

  • The keywords can not be an identifier.
  • The meaning of the reserved words or keywords has already been  explained to the C compiler.
  • All keywords in C must be written in lowercase.

As we have already mentioned that C has different standards. Each standard has a distinct number of keywords.

  • The ANSI C has 32 keywords in it. which are mentioned below


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


The C99 has 37 keywords in it. There are 32 keywords in it which are taken from ANSI C which we have already mentioned in above. The C99 added five more keywords  which are  _Bool, _Complex, _Imaginary, inline and restrict  in ANSI C.In C language, starting with an underscore and a capital letter is not common for keywords in C. That’s why  the new words are used through their macros, which keeps the coding style clean.


keyword Macro Macro defined in
_Bool bool stdbool.h
_Complex complex complex.h
_Imaginary imaginary complex.h
restrict - -
inline - -


The _Bool  keyword is used to declare an integer which is capable of storing  0 and 1.

Syntax of __Bool keyword:

bool <variable name>;


The  _Imaginary and  _Complex used to declare complex and imaginary which are capable of storing floating point complex numbers.They only work with double, float and long double.

Syntax of __imaginary data type:

double _Imaginary <variable name>;
float _Imaginary <variable name>;


Syntax for __Complex data type:

float  _Complex <variable name>;
long double _Complex <variable name>;


  • The restrict keyword in C is used to declare a pointer. Through restrict keyword the compiler got to know that for the lifetime of a pointer, only the pointer itself or a value directly derived from it will be used to access the object to which it points.

Syntax for restrict pointers:

int *restrict <variable name>;
float *restrict <variable name>;
void *restrict <variable name>;


  • The C11 has 44 keywords in it. Starting 32 keywords of C11 is taken from ANSI C and 5 keywords from C99 which we have already discussed. There are 7 more keywords added to the C language, which are _Noreturn, _Generic, _Atomic, _Alignof,  _Static_assert, _Alignas and  _Thread_local.


keyword macro Macro def ined in
_Alignas alignas stdalign.h
_Alignof alignof stdalign.h
_Atomic atomic stdatomic.h
_Noreturn noreturn stdnoreturn.h
_Generic - -
_Thread_local - -
_Static_assert static_assert assert.h


Note: We will further discuss these data types in detail.