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);

}



what would be the output of the following prog? Justify your answer? main() { unsigned char ch;..

Answer / 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

More C Interview Questions

What does *p++ do?

0 Answers  


Explain union. What are its advantages?

0 Answers  


regarding pointers concept

0 Answers  


Should I use symbolic names like true and false for boolean constants, or plain 1 and 0?

0 Answers  


hi how to convert program from notepad to turboc editor can u please help me

3 Answers  






Do you know the use of fflush() function?

0 Answers  


consider the following structure: struct num nam{ int no; char name[25]; }; struct num nam n1[]={{12,"Fred"},{15,"Martin"},{8,"Peter"},{11,Nicholas"}}; ..... ..... printf("%d%d",n1[2],no,(*(n1 + 2),no) + 1); What does the above statement print? a.8,9 b.9,9 c.8,8 d.8,unpredictable value

4 Answers   TCS,


Are local variables initialized to zero by default in c?

0 Answers  


Explain what is wrong with this program statement?

0 Answers  


How do you generate random numbers in C?

0 Answers  


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

0 Answers  


difference between function & structure

9 Answers   Verizon,


Categories