What will be the output of the given C program? int main() {
What will be the output of the given C program?
#include <stdio.h>
int main() {
int a = 4;
int b = 3;
int result;
result = a ^ b;
printf("%d", result);
return 0;
}
Show answerHide answer
Correct answer: (D) 7
Explanation
^ is bitwise XOR: 4 = 100 and 3 = 011, so 100 XOR 011 = 111 = 7.