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
I have a varargs function which accepts a float parameter?
What is sizeof array in c?
a linearly ordered set of data elements that have the same structure and whose order is preserved in storage by using sequential allocation a) circular b) ordinary c) array d) linear list
Is it acceptable to declare/define a variable in a c header?
The difference between printf and fprintf is ?
What is main () in c language?
If errno contains a nonzero number, is there an error?
What does return 1 means in c?
What is double pointer?
Can we change the value of #define in c?
Why clrscr is used after variable declaration?
Draw a flowchart to produce a printed list of all the students over the age of 20 in a class .The input records contains the name and age of students. Assume a sentinel value of 99 for the age field of the trailer record
When c language was developed?
Why doesnt this code work?
What are identifiers and keywords in c?