English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

C Language Basic Tutorial

C Language Flow Control

C Language Functions

C Language Arrays

C Language Pointers

C Language Strings

C Language Structure

C Language File

C Others

C Language Reference Manual

C Language Keywords and Identifiers

In this tutorial, you will learn about keywords. Reserved words in C programming that are part of the syntax. In addition, you will also learn about identifiers and their naming methods.

Character set

The character set is a set of letters, numbers, and special characters that are valid in the C language.

Letters

Uppercase letters: A B C ... X Y Z
Lowercase letters: a b c ... x y z

C accepts both lowercase and uppercase letters as variables and functions.

Numbers

0 1 2 3 4 5 6 7 8 9

Special characters

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

Space character

Spaces, newlines, horizontal tabs, carriage returns, returns, and form feeds.

C Language Keywords

Keywords are predefined reserved words used in programming that have special meaning to the compiler. Keywords are part of the syntax and cannot be used as identifiers. For example:

int money;

Here, 'int' is a keyword indicating that it isVariable money is of int (integer) type.

Since C is a case-sensitive language, all keywords must be written in lowercase. This is the list of all keywords allowed in ANSI C.

C Language Keywords
autodoubleintstruct
breakelselongswitch
caseenumregistertypedef
charexternreturnunion
continueforsignedvoid
doifstaticwhile
defaultgotosizeofvolatile
constfloatshortunsigned

All these keywords, their syntax, and applications will be discussed in their respective topics. If you want to view all the keywords in C language, please visitList of all keywords in C programming.

C Language Identifiers

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

Identifiers must be unique. They are created to provide a unique name for entities so that they can be identified during program execution. For example:

int money;
double accountBalance;

Here, 'money' and 'accountBalance' are identifiers.

Remember that the name of an identifier must be different from keywords. Since 'int' is a keyword, 'int' cannot be used as an identifier.

Identifier naming rules

  1. A valid identifier can contain letters (both uppercase and lowercase), numbers, and underscores.

  2. The first character of an identifier should be a letter or an underscore.

  3. Keywords cannot be used as identifiers.

  4. The length of the identifier is not specified. However, if the identifier exceeds31characters, there may be problems in some compilers.

If the above rules are followed, any name can be chosen as an identifier, but it is recommended to use meaningful identifiers to specify meaningful variable names.