C Tokens
The smallest individual units in a program are known as tokens. C language has the following tokens:
- Keywords
- Identifiers
- Constants
- Strings
- Operators
Keywords
The keywords specify specific C language features. They are reserved words and cannot be used as the variable name or any user-defined elements name. There are 32 keywords in C. They are given below:
auto | break | case | char | const |
double | else | enum | extern | float |
int | long | register | return | short |
struct | switch | typedef | union | unsigned |
volatile | while | sizeof | static | goto |
default | do | continue | for | signed |
void | if |
Identifiers
Identifiers refer to the names of variables, functions, arrays, classes etc given by the programmer. Each language has its own rules for naming the identifiers. The following rules are for C:
- Only alphabets, digits and underscores are valid.
- Cannot start with a digit.
- Identifiers are case sensitive.
- Cannot use a keyword as identifiers.
- Must not contain white spaces.
- First 31 characters are significant.
Constants
Constants refer to fixed values that do not change during the execution of a program. Constants are also called literals. C supports several kinds of literal constants. They include integers, characters, floating point numbers and strings. Example:
- 72 //decimal integer
- 72.5 //floating type integer
- 037 //octal integer
- 0X3 //hexadecimal integer
- "C" //string
- 'D' //character
Operator and String will be discussed later in this tutorial.