Thursday, December 25, 2008

Hexadecimal number Questions with Answers in C Programming


Q. 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

No comments:

Blog List