Consider this C program:
unsigned char c2 = '\0101';
printf("%c, %d\n", c2, c2);
I believe that the output should be: A 65 but the actual output is 1 49.
Reasoning: 0 as prefix in character constant declares it in octal format and octal value of 101 is 65. Then the ASCII value corresponding to 65 is A. Can someone tell me where I am going wrong? I tried the same code for hexadecimal as '\x41' and it gave the desired output.