What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 2;
x = x << 1;
printf("%d\n", x);
}
#include <stdio.h>
int main()
{
int x = 2;
x = x << 1;
printf("%d\n", x);
}A. 4
B. 1
C. Depends on the compiler
D. Depends on the endianness of the machine
Answer: Option A

Join The Discussion