what would be the output of the following prog? Justify
your answer?
main()
{
unsigned char ch;
unsigned char i;
ch = -255;
printf("%d",ch);
i = -1;
printf("%d",i);
}
Answer Posted / bittu
1255
this is because -255 (00000001) when considered unsigned
looks like 1(00000001) in binary and -1(11111111) when
considered unsigned looks like 255(11111111) in binary
(11111111).
refer to this
http://www.allaboutcircuits.com/vol_4/chpt_2/3.html
Is This Answer Correct ? | 5 Yes | 0 No |
Post New Answer View All Answers
What is unsigned int in c?
writ a program to compare using strcmp VIVA and viva with its output.
How do I convert a string to all upper or lower case?
What is the difference between volatile and const volatile?
Does free set pointer to null?
which of the following is not a character constant a) 'thank you' b) 'enter values of p, n ,r' c) '23.56E-o3' d) all of the above
How would you rename a function in C?
What is the purpose of realloc()?
What are the 4 data types?
How can I delete a file?
What is an array? What the different types of arrays in c?
Do pointers need to be initialized?
what is a function method?give example?
show how link list can be used to repersent the following polynomial i) 5x+2
List the difference between a While & Do While loops?