6 votes 6 votes Find the type of error produced by the following C code. main() { in/*comment t x; floa/*comment*/t gate; } Lexical error syntax error both a) and b) None of these Compiler Design lexical-analysis syntax-analysis compiler-tokenization + – Ashwani Kumar 2 asked Feb 7, 2017 reopened Feb 21, 2021 by Arjun Ashwani Kumar 2 5.2k views answer comment Share Follow See all 31 Comments See all 31 31 Comments reply Show 28 previous comments samarpita commented Nov 1, 2021 reply Follow Share why not syntax error? 0 votes 0 votes samarpita commented Nov 1, 2021 reply Follow Share @Arjun sir please this 0 votes 0 votes Hira Thakur commented Sep 9, 2022 reply Follow Share Duplicate: 1) https://gateoverflow.in/117189/type-of-error 2) https://gateoverflow.in/74153/me-test-series?show=74153 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes You can not use comment lines in between characters of any keyword. Ex : fl/*gateoverflow*/oat a; This will result in error. Anup patel answered Dec 30, 2016 Anup patel comment Share Follow See 1 comment See all 1 1 comment reply Mukul Goswami commented Dec 30, 2016 reply Follow Share All the comments and consequtive whitespaces are removed by the compiler and is replaced by single blank. So, in this question after. in /*----- */ is removed and result becomes in space t space gate followed by semi colon This is clearly a syntax error. The variable gate used is un-defined. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes here is only semantic error as comment between the words result in space after the compilation so there will be syntatical error i.e. error in meaning of the particular identifier is not define akankshadewangan24 answered Apr 24, 2017 edited Apr 24, 2017 by akankshadewangan24 akankshadewangan24 comment Share Follow See all 0 reply Please log in or register to add a comment.
0 votes 0 votes By removing the comments the code will be main() { in t gate; } So in this code 9 tokens are present so not lexical error But as in and t are treated as functions who not contains ; this are the syntax errors Ans : b. Syntax Error Abhishek24 answered Jun 14, 2022 Abhishek24 comment Share Follow See all 0 reply Please log in or register to add a comment.