Write the type of tokens from the following:
(i) if (ii) roll_no
Answers
Answered by
17
Answer:
(i) if is a keyword
(ii)roll-no is a identifier
keywords: These are predefined words with special meaning to the language compiler..Eg : if,and
Identifier:Names given to different parts of the program
Answered by
2
- Tokens are the smallest individual elements in a program that are relevant to a compiler's operation.
- A token is the smallest unit of measurement in a C program.
- Every single punctuation mark and word in a C program is a token.
(i) Keywords are syntax elements that cannot be used as identifiers.
For example, 'if' is a programming structure used for decision control.
Hence, 'if' is a keyword.
(ii) An identifier is a string of alphanumeric characters that begins with a letter of the alphabet or an underline and ends with another letter of the alphabet, a numeric digit, or an underscore.
'roll_no' is a string that consists of alphabets and underscore.
Hence, 'roll_no' is an identifier.
#SPJ2
Similar questions