3 3 votes Predict the output of following program. Assume that the numbers are stored in 2's complement form. #include<stdio.h> int main() { unsigned int x = -1; int y = ~0; if (x == y) printf("same"); else printf("not same"); return 0; } 1.SAME 2.NOT SAME Programming in C programming-in-c + – Shashank Kumar Mishr 1.6k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 4 4 votes #include <stdio.h> int main() { unsigned int x = -1; // bit pattern = all ones int y = ~0; // bit pattern = all ones if (x == y) // y is promoted to unsigned int // ( as common type) for comparison printf("same"); // gets printed else printf("not same"); return 0; } dd answered May 17, 2017 • selected Jul 8, 2017 by dd dd comment Share Follow 0 reply Please log in or register to add a comment.