0 votes 0 votes Identify the total number of tokens in the given statement printf("A%B=",&i); $7$ $8$ $9$ $13$ Compiler Design nielit-2018 compiler-design compiler-tokenization + – Arjun asked Dec 7, 2018 edited Dec 16, 2022 by gatecse Arjun 2.6k views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
3 votes 3 votes "A%B=" is counted as one so total tokens are 8 1. printf 2. ( 3. "A%B=" 4. , 5. & 6. i 7. ) 8. ; Peeyush Pandey answered Dec 7, 2018 Peeyush Pandey comment Share Follow See all 2 Comments See all 2 2 Comments reply poocharaajaavu commented Dec 16, 2022 reply Follow Share There’s no comma in the given statement. 0 votes 0 votes rsansiya111 commented Dec 17, 2022 reply Follow Share NO sir 0 votes 0 votes Please log in or register to add a comment.
1 votes 1 votes $\textrm{Total number of token is 7 here.}$ $printf$ $($ $\textrm{”A%B”}$ $\textrm{&}$ $i$ $)$ $;$ $\textrm{Option A }$ Hira Thakur answered Sep 22, 2020 Hira Thakur comment Share Follow See 1 comment See all 1 1 comment reply _Shubham_.Singh_ commented Sep 1, 2023 reply Follow Share Why haven’t you considered comma in this question ? 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes the tokens are: printf - a function that prints output to the console ( - left parenthesis "A%B=" - a string literal , - a comma & - the address-of operator i - a variable ) - right parenthesis The semicolon at the end of the statement is not a token. It is a statement terminator that indicates the end of the statement in C-style languages. rsansiya111 answered Dec 17, 2022 rsansiya111 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes I See that people are merely justifying the answers key with 7 tokens, but the real answer is going to be 8 tokens.Someone missed comma, someone says semicolon is not included etc; ignore them and see the official grammar of C - both $comma$ and $semicolon$ are valid tokens.Here is breakdown for all 8 tokens in the statement :Tokens and Their ValuesToken CategoryToken NumberToken Valueidentifier1'printf'l_paren2'('string_literal3'"A%B="'comma4','amp5'&'identifier6'i'r_paren7')'semi8';' yadavmayank742 answered Feb 18 yadavmayank742 comment Share Follow See all 0 reply Please log in or register to add a comment.