0 0 votes What will be the output of the following C program? #define b ++a void main() { char a=2689; printf(“%d”, b); } Programming in C + – saurav raghaw 1.3k views answer comment Share Follow Print See all 6 Comments 6 6 Comments reply Shobhit Joshi commented Dec 26, 2018 reply Follow flag binary of $a = 0000101010000010$, as a is $char$ only the first $8$ bits are used. $a=10000010$ b = ++a = 10000011 = -126 printf(“%d”, b); should print $-126$. Correct me if i'm wrong 3 3 replyShare Deepanshu commented Dec 26, 2018 reply Follow flag hmmShobhit Joshi u r correct i think 0 0 replyShare saurav raghaw commented Dec 26, 2018 reply Follow flag right. 0 0 replyShare Abhisek Tiwari 4 commented Dec 26, 2018 reply Follow flag @Shobhit Joshi why u taken a as 16 bit? 0 0 replyShare saurav raghaw commented Dec 26, 2018 reply Follow flag I think we can represent 2689 in binary as 101010000010, but as a is char so it will store only first(from the right side) 8 bit. 0 0 replyShare vg653 commented Dec 27, 2018 reply Follow flag @Shobhit Joshi sir, I am unable to understand the logic ? please provide detailed explanation behind the concept!! 0 0 replyShare Please log in or register to add a comment.
0 0 votes -126 due to wrap around ronakhil7 answered Dec 27, 2018 ronakhil7 comment Share Follow 0 reply Please log in or register to add a comment.