Discussion Locked

This question is releated to C Langauge

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

What is the answer of the following and how it is comming:-

#include
#include
main()
{
char a='\101'
printf("%c",a);
}

7 replies

by bigbox

Maybe it's a "slip of the pen", but you forgot a semocolon after the definition of "a" variable.
I think, symbol with code decimal "101" will be printed. :)

by gary_w

When you prefix a number with a backslash, that means it's an octal (base 8) value.
Octal 101 = 'A'

by xorex

if correct:

#include
#include
main()
{
char a='\101' ; <- must be symbol ';'
printf("%c",a);
}

then will be printed 'A' - symbol with hex code 0x65

This discussion is closed to new replies.