Best Services Buy

Monday, 25 July 2016

Keywords, Tokens, Identifier in C

Keywords are pre – defined (already defined) words in a C compiler. Every keyword is meant to perform a specific function i.e. There are 32 keywords in c ( i.e.  while, do, switch, else, if  for,  go to, default, auto, break, continue, const, char, case, float, void etc) Keywords cannot be used as variable name. The most important keywords are

auto
double
int
struct
const
float
short
unsigned
break
else
long
switch
continue
for
signed
void
case
enum
register
typedef
default
goto
sizeof
volatile
char
extern
return
union
do
if
static
while

Identifier : –

Identifier refer to name of variable, functions and array these are defined by user but they cannot have letters and digits, with a letter as a first character. Both uppercase and lowercase letters are permitted but lower case letters are commonly used.

Rules of identifier:-

First character must be an alphabet.
Only first 31 characters are significant.
Cannot use a keyword.

C tokens: –

In a passage of text Individual words and punctuation marks are called tokens. Similarly in C program the smallest individual units are known as C Tokens.

There are six types of C tokens.

Keywords(eg: int, while)
Identifiers(eg: main, total)
Constants(eg: 15, 4)
Strings(eg: “safal”, “hi”)
Special symbols(eg: (), {}, [])
Operators(eg: +,-,*, /,%)
 Previous page
 Learn More  
                                                                                                                    

No comments:

Post a Comment