The number of tokens in the following C statement is (GATE 2000)
printf("i = %d, &i = %x", i, &i);
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.
Below are tokens in above program.
printf ( "i = %d, &i = %x" , i , & i ) ;
- C | Operators | Question 27
- C | Misc | Question 6
- C | Dynamic Memory Allocation | Question 8
- C | Misc | Question 2
- C Quiz – 102 | Question 2
- Output of C programs | Set 64 (Pointers)
- C | Macro & Preprocessor | Question 15
- C | C Quiz – 113 | Question 1
- Compiling a C program:- Behind the Scenes
- C Quiz – 112 | Question 5