0 votes 0 votes Programming in C programming programming-in-c + – Shivam Chauhan asked Dec 9, 2017 Shivam Chauhan 433 views answer comment Share Follow See all 6 Comments See all 6 6 Comments reply Shivam Chauhan commented Dec 9, 2017 i edited by Shivam Chauhan Dec 9, 2017 reply Follow Share Answer given is: Compile error But I ran it on several compilers and output = 56 @joshi_nitish @just_bhavana @Anu007 @rahul+sharma+5 0 votes 0 votes just_bhavana commented Dec 9, 2017 reply Follow Share It is printing ASCII value of 8 but not getting how! even though compiler is giving multi-character character constant warning 0 votes 0 votes joshi_nitish commented Dec 9, 2017 reply Follow Share if char a='1' , a=ascii(1) =49 if char a='10', a=ascii(0) =48 if char a='1a2', a=ascii(2)= 50 if char a ='9563a7', a=ascii(7)= 55 if char a='\08', a=ascii(8)= 56 literals inside ' ' are treated as character constants, and if more than one character symbols are inside ' ' then last symbol among them is taken as shown above. 1 votes 1 votes Shivam Chauhan commented Dec 9, 2017 i edited by Shivam Chauhan Dec 9, 2017 reply Follow Share char can be initialized as: char c = 'a' char c = 97 // ASCII value of a char c = '\141' // octal value of a char c = '\x61' // hex value of a Ace academy took it as: '\08' octal value but octal value can take only 0 to 7 values so they gave compile error But @joshi_nitish Thanks Compiler took it as multicharacter and c = ASCII Value of 8 = 56 1 votes 1 votes just_bhavana commented Dec 9, 2017 reply Follow Share @Shivam For char c = 'x61' value printed is 49, but when I simply did char c = 0x61, it prints 97 correct. why is it printing 49 in the first case ? I think for hex value of a, the correct declaration is char a = '\x61' ; 0 votes 0 votes Shivam Chauhan commented Dec 9, 2017 reply Follow Share Thanks @just_bhavana I forgot to put '\' character 0 votes 0 votes Please log in or register to add a comment.