C Keywords and Identifiers

C Keywords and Identifiers

You will learn about keywords in this tutorial; reserved words in C programming that are part of the syntax. You will also learn how to name identifiers.

Character set

In C language, a character set consists of alphabets, letters, and some special characters.

Alphabets

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

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

The C programming language accepts both lowercase and uppercase alphabets as variables and functions.

Digits

"0 1 2 3 4 5 6 7 8 9"

Special Characters

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

White Spaces

Newlines, horizontal tabs, carriage returns, and form feeds.

Type C.

KeyCompilers have special meanings for predefined, reserved words used in programming.ywords are part of the syntax and they cannot be used as an identifier. For example:

"int money;"

The keyword int indicates that money is a variable of type int (integer).

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

C Keywords
autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
continueforsignedvoid
doifstaticwhile
defaultgotosizeofvolatile
constfloatshortunsigned

The syntax and application of each of these keywords will be discussed in their respective topics. If you want a brief overview of these keywords without going further, visit List of all C programming keywords.

C Identifiers

An identifier is a name that is given to an entity, such as a variable, function, or structure.

Unique identifiers are required. To identify an entity during the execution of a program, they are used to give it a unique name. For instance:

"int money;

double accountBalance;"

Rules for naming identifiers

  1. A valid identifier can include letters (both uppercase and lowercase letters), digits, and underscores.
  2. An identifier should begin with either a letter or an underscore.
  3. As identifiers, you cannot use keywords such as int, while, etc.
  4. An identifier does not have a length restriction. Some compilers may have problems with identifiers longer than 31 characters.

When following the above rule, you can choose any name for your identifier. However, give meaningful names to those identifiers that make sense.