The Gateway to Computer Science Excellence
+1 vote
304 views

consider this c code:

wheil(1){
    printf("hi");
}

will this code fragment gives lexical error or not. If not then who is responsible for this error.

in Compiler Design by | 304 views
+1

No lexical error

https://gateoverflow.in/201833/lexical-syntax-and-semantic-error 
check this answer for understanding lexical error 

2 Answers

+4 votes
Best answer

NO lexical error .

whiel will be treated as a function name ,hence a token is generated.so there is no lexical error .

it is a semantic  error becz we are colling a function which is not defined.

https://gateoverflow.in/165048/lexical-error

by
selected by
+1 vote
No it is not lexical error. There will be no Syntax error as well, but there will be a semantic error because it does not recognize wheil.
by

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
52,345 questions
60,471 answers
201,797 comments
95,273 users