What will be the output of the following C code?
#include <stdio.h>
int main()
{
int x = 3, i = 0;
do {
x = x++;
i++;
} while (i != 3);
printf("%d\n", x);
}
#include <stdio.h>
int main()
{
int x = 3, i = 0;
do {
x = x++;
i++;
} while (i != 3);
printf("%d\n", x);
}
A. Undefined behaviour
B. Output will be 3
C. Output will be 6
D. Output will be 5
Answer: Option B
Join The Discussion