Keywords and Identifiers
Tokens are the smallest individual unit of program. C has following six type of tokens.
- Special symbol
For example, the following C statement consists of six tokens:
Identifier are the name used to identify a variables, functions and user-defined names. It consisits of both uppercase and lowercase characters ,underscore ( _ ) and digits.
Rules of Identifiers
- An identifier starts with a letter A to Z, a to z, _ followed by zero or more letters, underscore and digits.
- Must not contain special characters such as @, $, and % and white space.
- Keyword cannot be used as a identifier.
Keywords are the reserved words with specific meaning. The keywords cannot be used as constants or variable or any other identifier. C has following keywords.
Constants are fixed value that do not change during execution of program. Constants are of following types :
- Integer Constants
- Real Constants
- Single Character Constants
- String Constants
Variable is the name of storage location that program can manipulate. Each variable has specific type which determines the size occupied by variable in memory.
Declaration of Variables
Declaration specify two things :
- It tells the name of variable to compiler.
- It tells the type of data that variable will store.
data-type var1, var2;
Where v1, v2 are variable name.
int ,double are keyword representing the data type. And n, s, a, ratio are variable names.