- C Programming Tokens are the smallest individual parts of a Program.
Types of Token:
- Keyword
- Identifiers
- Constants
- Strings
- Special Symbol
- Operators
1. Keyword:
- Keywords are the reserve words having a fixed meaning given by the compiler.
- We have to use the keywords in lower case letter.
- Ex: void, for, else, if, struct, class, while, do, union etc.
2. Identifiers:
- Identifiers used to identify the variables, functions, pointers and some user-defined datatypes.
- Rules for Identifiers:
- The name of an Identifier always starts with an alphabet or underscore ( _ ).
- It must not be a keyword.
- There mustn't have any space in between any alphabets.
- Identifiers are case sensitive.
- Punctuation and special characters aren’t allowed except underscore.
- It may be the combination of alphabets and digits, but the 1st letter must be an alphabet.
3. Constants:
- C constants are like normal variables, but only difference is their value can't be modified by the program once defined.
- Constants have the fixed values.
- The constants are also called as Literals.
- Constants may belonging to any of the datatypes.
4. Strings:
- Strings are the collection of characters.
- These are written in double quoted form only.
- Always the strings are teminated with a null charachter.
5. Special Symbols:
- The spcial symbols are used in a C Program to define some cases like beginning, termination etc.
- Ex:
- Curle braces - {}
- Parenthesis - ()
- Semicolon - ;
- Comma - ,
- Colon - :
6. Operators:
- Operator are the symbols which are used to perform logical and mathematical operations in a Program.
- Ex: +, -, *, /, %, =, ++, --, ==, += etc.