Tokens

Smallest individual word is nothing but token. Tokens are 6 types
1. Keywords (or) Reserved Words
2. Identifiers
3.String
4.Variable
5.Constant
6. Operators


Reserved words (or) key words

Keywords are the words whose meaning has already been explained to the C compiler. The keywords cannot be used as variable names. They are
auto
break
case
char
const
continue
default
do
double
else
enum
extern
float
for
goto
if
int
long
register
return
short
signed
sizeof
static
struct
switch
typedef
union
unsigned
void
volatile
while


Identifiers

Any name is identifier except keywords. Like variable names, function names, label names etc. Identifiers are variables used to hold data values.

Rules to write Identifier names:

  • A identifier name contains maximum of 32 characters.
  • A identifier name includes _,alphabets and numbers, but it must start with an alphabet or _(underscore).
  • It cannot accept any special characters, blank spaces except under score( _ ).
  • It should not be a Key word (reserve word).
  • Upper case and lower case letters are different.


String

String is a collection of characters. 


Variable

it is a value which changes its value during program execution. 


Constant

If want to make any variable as a constant use const keyword. Then we can use anywhere in the function if it is local. Global means we can use in any function.

No comments:

Post a Comment