2 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 1.5k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply Show 2 previous comments air1 commented Nov 12, 2016 reply Follow flag 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 0 replyShare Kapil commented Nov 12, 2016 reply Follow flag Why semantic ? 0 0 replyShare air1 commented Nov 12, 2016 reply Follow flag @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 0 replyShare Please log in or register to add a comment.
0 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 2 2 Comments reply Arjun commented Jan 25, 2016 reply Follow flag it is just 10 as 10.3 gets implicitly type casted to 10 on assignment to an int variable. 1 1 replyShare Sourasekhar Banerjee commented Jan 25, 2016 reply Follow flag 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 0 replyShare Please log in or register to add a comment.