Saturday, 25 February 2017

GATE EXAM PREPARATION IN "C" - number of tokens(GATE 2000)

The number of tokens in the following C statement.
printf("i = %d, &i = %x", i, &i);


is 
(a) 3
(b) 26
(c) 10
(d) 21
Answer (c)
Explanation:In a C source program, the basic element recognized by the compiler is the “token.” A token is source-program text that the compiler does not break down into component elements.
There are 6 types of C tokens : identifiers, keywords, constants, operators, string literals and other separators. There are total 10 tokens in the above printf statement.


No comments:

Post a Comment