0 votes 0 votes the given ans is (d) but it will run forever as ch is character type and can have max value 255 and then it will be reset. also char would be implicitly typecasted to int so comparison is valid. why would it give compilation error Abhishekcs10 asked Dec 14, 2015 Abhishekcs10 522 views answer comment Share Follow See all 0 reply Please log in or register to add a comment.
Best answer 4 votes 4 votes Semicolon after 'char ch = 1' Is missing. monanshi answered Dec 14, 2015 selected Dec 14, 2015 by Abhishekcs10 monanshi comment Share Follow See all 3 Comments See all 3 3 Comments reply Abhishekcs10 commented Dec 14, 2015 reply Follow Share missed the simple thing... semicolon ---hide and seek champion..:p 0 votes 0 votes Sourabh Kumar commented May 4, 2016 reply Follow Share Char ch='1'; And char ch=1; What is the difference between them 0 votes 0 votes Abhishekcs10 commented May 5, 2016 reply Follow Share char ch='1' will set the ch value equal to ascii value of 1 i.e. 49 (this value will be printed if u use %d to print ch value in printf); other way to say this is.. char ch='1' is equivalent to char ch=49; while char ch=1 will set the ch value equal to ascii value 1 (not ascii value of '1') i.e. character whose ascii value is 1 will be stored in ch (as per wiki its SOH-start of heading)...:) 0 votes 0 votes Please log in or register to add a comment.