What happens if you compile and run the following c code? struct marks int p:3; int c:3; int m:2; }; void main() struct markings s=2,-6,5; printf("percent d percent d percent d",s.p,s.c,s.m); }
A. 2 -6 5
B. 2 -6 1
C. 2 2 1
D. Error in compilation
Answer:C
What happens if you compile and run the following c code? struct marks int p:3; int c:3; int m:2; }; void main() struct markings s=2,-6,5; printf("percent d percent d percent d",s.p,s.c,s.m); }
A. 2 -6 5 B. 2 -6 1 C. 2 2 1 D. Error in compilation
Explanation: The binary value for 2 is 00000010. (Select three two bit) The binary value of 6 is 00000110. The binary value of -6 is 11111001+1=11111010. (Select the last three bits) The binary value of 5 is 00000101. (Select last two bit)