577 views
1 votes
1 votes

What is the earliest stage compiler error for the following C code snippet:

int x = @33;
  1. Lexical Error
  2. Syntax Error
  3. Semantic Error
  4. None

2 Answers

Best answer
3 votes
3 votes

Answer: Option A) Lexical Error

The compiler will show a lexical error because of the "@" symbol in $@33$. It is not a valid character for variable assignment in the C programming language.  An identifier can only have alphanumeric characters (a-z , A-Z , 0-9) (i.e. letters and digits) and underscore $(\_)$ symbol.

selected by
1 votes
1 votes
The earliest stage compiler error for the given C code snippet is a lexical error. This is because @ is not a valid token in the C language, so the compiler would detect it as a lexical error at the very beginning of the compilation process.

Related questions

1 votes
1 votes
0 answers
3
Nishi Agarwal asked Mar 17, 2019
5,155 views
32: A sender needs to send the four data items Ox3456, OxABCC, Ox02BC, and OxEEEE. Answer the following:a. Find the checksum at the sender site.b. Find the checksum at th...