- Every C-Program statement contains C-token.
- A token is a smallest unit in C-programing language.
- They are the building blocks of the program.
- C-token can be divided into the following categories.
[1] Keyword
- A keyword is a basic building block of any programming language.
- Their meanings are per-defined to the compiler and it cannot be change.
- C-language provides 32 keyword.
- All c – keyword are written in lower case only.
- It cannot be used as a variable name.
- Example of some keyword are main, break, if ,int, float,for,exit,etc..
[2] Identifier:
- An identifier is a named memory area that is used to store value.
- It is user define name that are used to refer any variable array or function.
- Identifier can be defining using both lower case and upper case letters but normally lower case letters are used.
- Each identifier should follow naming convention rules.
- Some valid identifier examples are: name, salary, year, amount, etc.
[3] Constant
- A constant is a variable whose value does not change throughout the program.
- It can be further divided into the following categories.
[1] Numeric Constant:
- A numeric constant contain digits from 0 to 9.
- It has the following two types:
[A] Integer Constant:
- An integer constant contains integer value; it does not contain fractional part.
- It may be negative or positive.
- Example: 100, -25, 50
- An integer constant may also represent in following three types.
[a] Decimal [b] Octal [c] Hexadecimal
(B) Real Constant:
- A real constant contains numerical value with fractional part.
- It may be positive or negative.
- Example: 10.5, -0.050, 25.075
[2] Character Constant:
- Character constant contains alphabets from a to z.
- It can be represent in following forms
[A] Single Character Constant
- Single character constant includes single character or digit enclosed by signal quote.
- Example: ‘a’, ‘10’, ‘-5’
[B] String Constant
- A string constant contains multiple characters enclosed by double quote
- Example:”hello”, “123”, “ABC”.
[4] String:
- String is a sequential series of characters enclosed within double quote(“”).
- Example:”HELLO”,”123”,”ABC”
[5] Special symbols:
- Some special symbols are used to specify the operation or to direct the compiler to perform the task.
- Special symbols includes &,!,(), [],{},*,^,<>
[6] Operator:
- Operators are used to direct the compiler to perform some logical or arithmetic calculation.
- Operators are uses with the operand.
- It can be dividing into the following categories.