2 votes 2 votes identify the type of error int main() { int gate,exam,rank; gate=exam=rank=10.3; printf("%c",gate); } a)lexical error b)syntax error c)semantic error d)none of these Compiler Design compiler-design lexical-analysis + – Pooja Palod asked Jan 15, 2016 • edited Jun 18, 2022 by Lakshman Bhaiya Pooja Palod 763 views answer comment Share Follow See all 5 Comments See all 5 5 Comments reply Show 2 previous comments air1 commented Nov 12, 2016 reply Follow Share According to the definitioon here http://stackoverflow.com/questions/7849684/what-is-semantic-errors-in-c-language-give-some-examples this should be a semantic error. Can someone confirm? 0 votes 0 votes Kapil commented Nov 12, 2016 reply Follow Share Why semantic ? 0 votes 0 votes air1 commented Nov 12, 2016 reply Follow Share @Kapil According to the definition in that link, "Semantic errors. These are valid code the compiler understands, but they do not what you, the programmer, intended." Here it doesnt seem like the programmer intended to print the new line character. However, I am not sure if this is the definiton that is usually followed for semantic errors. 0 votes 0 votes Please log in or register to add a comment.
0 votes 0 votes It won't print anything as ASCII character for 10.3/10 is newline; so it won't print anything , but go to the next line. I don't think any error is present. So, D Sourasekhar Banerjee answered Jan 25, 2016 • edited Jan 25, 2016 by Sourasekhar Banerjee Sourasekhar Banerjee comment Share Follow See all 2 Comments See all 2 2 Comments reply Arjun commented Jan 25, 2016 reply Follow Share it is just 10 as 10.3 gets implicitly type casted to 10 on assignment to an int variable. 1 votes 1 votes Sourasekhar Banerjee commented Jan 25, 2016 reply Follow Share Sorry sir; silly mistake; ASCII value of 10 is new line; so it will not print anything I guess and simply mark the beginning of a new line? 0 votes 0 votes Please log in or register to add a comment.