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

Can the sizeof operator be used to tell the size of an array passed to a function?

0 Answers  


What is output redirection?

0 Answers  


Give the logic for this #include<stdio.h> #include<conio.h> void main() { clrscr(); int a=10,b; b=++a + ++a; printf("%d", b); getch(); } Output: 24......How?

2 Answers   Accenture,


what is the answer for it main() { int i; clrscr(); printf("%d",&i)+1; scanf("%d",i)-1; }

3 Answers  


You have an array of n integers, randomly ordered with value 1 to n-1.The array is such that there is only one and one value occurred twice. How will you find this number?

1 Answers  






how should functions be apportioned among source files?

0 Answers  


Is c compiled or interpreted?

0 Answers  


which is the best antivirus and how to update it

7 Answers   Infosys,


. Consider the following program main() { int a[5]={1,3,6,7,0}; int *b; b=&a[2]; } The value of b[-1] is (A) 1 (B) 3 (C) -6 (D) none

9 Answers   Oracle,


What is hungarian notation? Is it worthwhile?

0 Answers  


What is static memory allocation? Explain

0 Answers  


the expression a=30*1000+2768; evalutes to a) 32768 b) -32768 c) 113040 d) 0

1 Answers  


Categories