Hexadecimal number questions with solutions in c program



(8) What will be output:

void main()
{
char a='\x82';
clrscr();
printf("%d",a);
getch();
}
Output:-126

Explanation: \x symbol indicate the hexadecimal number system in character constant. So 82 is hexadecimal number its equivalent binary value is 130. 130 is beyond the range of signed char. Since signed char is cyclic in nature so its value will be
130-256=-126
(For more detail visit the link data type)

No comments: