C Programming Keywords and Identifiers

In this tutorial, you will learn about keywords. Keywords are the reserved words in programming and are part of the syntax. Also, you will learn about identifiers and proper way to name an identifier.
List of keywords in C programming language

Character set

Character set is a set of alphabets, letters and some special characters that are valid in C language.

Alphabets

Uppercase: A B C ................................... X Y Z

Lowercase: a b c ...................................... x y z

Digits

0 1 2 3 4 5 6 7 8 9

Special Characters

Special Characters in C Programming
, < > . _
( ) ; $ :
% [ ] # ?
' & { } "
^ ! * / |
- \ ~ +  

White space Characters

blank space, new line, horizontal tab, carriage return and form feed

Keywords

Keywords are predefined, reserved words used in programming that have special meaning. Keywords are part of the syntax and they cannot be used as an identifier. For example:

int money;

Here, int is a keyword that indicates 'money' is a variable of type integer. 

As C is a case sensitive language, all keywords must be written in lowercase. Here is a list of all keywords allowed in ANSI C.

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

Along with these keywords, C supports other numerous keywords depending upon the compiler.

All these keywords, their syntax and application will be discussed in their respective topics. However, if you want a brief information on these keywords without going further, visit list of all keywords in C programming.

Identifiers

Identifiers are the names you can give to entities such as variables, functions, structures etc.

Identifier names must be unique. They are created to give unique name to a C entity to identify it during the execution of a program. For example:

int money;
double accountBalance;

Here, money and accountBalance are identifiers.

Also remember, identifier names must be different from keywords. You cannot use int as an identifier because int is a keyword.

Rules for writing an identifier

  1. A valid identifier can have letters (both uppercase and lowercase letters), digits and underscore only.
  2. The first letter of an identifier should be either a letter or an underscore. However, it is discouraged to start an identifier name with an underscore. It is because identifier that starts with an 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 on the length of an identifier. However, the first 31 characters of identifiers are discriminated by the compiler. So, the first 31 letters of two identifiers in a program should be different.

Good Programming Practice

You can choose any name for an identifier. However, if the programmer choose meaningful name for an identifier, it will be easy to understand and work on.