The number of tokens in the following C statement is (GATE 2000)
printf("i = %d, &i; = %x", i, &i;); |
chevron_right
filter_none
(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.
Below are tokens in above program.
printf ( "i = %d, &i = %x" , i , & i ) ;
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
Recommended Posts:
- C++ | Misc C++ | Question 8
- C++ | Misc C++ | Question 6
- C++ | Misc C++ | Question 1
- C++ | Misc C++ | Question 7
- C++ | Misc C++ | Question 3
- C | Misc | Question 2
- C | Misc | Question 1
- C | Misc | Question 6
- C | Misc | Question 8
- C++ | Misc C++ | Question 5
- C | Misc | Question 9
- C++ | Misc C++ | Question 2
- C | Misc | Question 7
- C | Misc | Question 5
- C | Misc | Question 6
- Algorithms | Misc | Question 3
- Algorithms | Misc | Question 11
- Algorithms | Misc | Question 11
- Algorithms | Misc | Question 10
- Algorithms | Misc | Question 11

