C Tokens, Keywords & Identifiers: Types & Examples
โก Smart Summary
Tokens in C are the smallest individual units the compiler reads, and every C program is built from six token types: keywords, identifiers, constants, strings, operators, and special symbols drawn from the C character set.

What is a Character Set in C?
Like every other language, C also has its own character set. A program is a set of instructions that, when executed, generate an output. The data that is processed by a program consists of various characters and symbols. The output generated is also a combination of characters and symbols.
A character set in C is divided into:
- Letters
- Numbers
- Special characters
- White spaces (blank spaces)
A compiler always ignores the use of characters, but it is widely used for formatting the data. Following is the character set in C programming:
1) Letters
- Uppercase characters (A-Z)
- Lowercase characters (a-z)
2) Numbers
- All the digits from 0 to 9
3) White spaces
- Blank space
- New line
- Carriage return
- Horizontal tab
4) Special characters
Special characters in C are shown in the given table:
| Special Character | Description |
| , (comma) | { (opening curly bracket) |
| . (period) | } (closing curly bracket) |
| ; (semi-colon) | [ (left bracket) |
| : (colon) | ] (right bracket) |
| ? (question mark) | ( (opening left parenthesis) |
| โ (apostrophe) | ) (closing right parenthesis) |
| โ (double quotation mark) | & (ampersand) |
| ! (exclamation mark) | ^ (caret) |
| |(vertical bar) | + (addition) |
| / (forward slash) | โ (subtraction) |
| \ (backward slash) | * (multiplication) |
| ~ (tilde) | / (division) |
| _ (underscore) | > (greater than or closing angle bracket) |
| $ (dollar sign) | < (less than or opening angle bracket) |
| % (percentage sign) | # (hash sign) |
What is a Token in C?
A token is the smallest unit in a C program. It is each and every word and punctuation that you come across in your C program. The compiler breaks a program into the smallest possible units (tokens) and proceeds to the various stages of the compilation. A C token is divided into six different types, namely Keywords, Operators, Strings, Constants, Special Characters, and Identifiers.
The next sections look at each of these token types, starting with the two that make up every C statement: keywords and identifiers.
Keywords in C
In C, every word can be either a keyword or an identifier.
Keywords have fixed meanings, and the meaning cannot be changed. They act as the building blocks of a C program. There are a total of 32 keywords in C. Keywords are written in lowercase letters.
The following table represents the keywords in C:
| Keywords in C Programming Language | |||
| auto | double | int | struct |
| break | else | long | switch |
| case | enum | register | typedef |
| char | extern | return | union |
| const | short | float | unsigned |
| continue | for | signed | void |
| default | goto | sizeof | volatile |
| do | if | static | while |
Identifiers in C
An identifier is nothing but a name assigned to an element in a program, for example, the name of a variable or a function. Identifiers in C language are the user-defined names consisting of the C standard character set. As the name says, identifiers are used to identify a particular element in a program. Each identifier must have a unique name. The following rules must be followed for identifiers:
- The first character must always be an alphabet or an underscore.
- It should be formed using only letters, numbers, or underscore.
- A keyword cannot be used as an identifier.
- It should not contain any whitespace character.
- The name must be meaningful.
Constants in C
A constant is a token whose value does not change during program execution. C constants let you store fixed data, such as numbers or text, and protect it from accidental modification. They fall into a few common categories:
- Integer constants โ whole numbers such as 10, -45, or 0.
- Floating-point constants โ real numbers with a decimal point such as 3.14 or -0.5.
- Character constants โ a single character inside single quotes such as ‘A’ or ‘9’.
- String constants โ a sequence of characters inside double quotes such as “Guru99”.
You can define a constant with the const qualifier or the #define preprocessor directive, for example const int DAYS = 7;. For a deeper look at declaring fixed values, see the guide on the C variable, data types, and constants.
Strings in C
A string in C is a one-dimensional array of characters terminated by a null character (\0). Because C has no dedicated string data type, string literals are stored as character arrays, and the null character marks where the text ends. This lets library functions find the end of the string without a separate length counter.
You can create a string in two common ways:
- As a character array:
char name[] = "Guru99"; - As a pointer to a literal:
char *name = "Guru99";
Both forms store the six visible characters plus the terminating null character. To explore character arrays and text handling further, read the tutorial on strings in C.
Operators in C
An operator is a token that instructs the compiler to perform a specific mathematical, relational, or logical operation on one or more operands. Operators are the action symbols of a C program, and the values they work on are called operands. C groups them into several families:
- Arithmetic operators โ perform calculations, such as +, -, *, /, and %.
- Relational operators โ compare two values, such as ==, !=, >, and <.
- Logical operators โ combine conditions, such as &&, ||, and !.
- Assignment operators โ store a value in a variable, such as = and +=.
- Bitwise operators โ work on individual bits, such as &, |, ^, and ~.
Together with keywords and identifiers, operators let a program express complete instructions that the compiler can translate into machine code.

