Thảo Justin
New member
What will be the final values of i and j in the following C code?
A. i value is 1 and j value is 1
B. i value is 0 and j value is 0
C. i value is 1 and j value is undefined
D. i and j value are undefined
Code:
#include <stdio.h>
int x = 0;
int main()
{
int i = (f() + g()) || g();
int j = g() || (f() + g());
}
int f()
{
if (x == 0)
return x + 1;
else
return x - 1;
}
int g()
{
return x++;
}
B. i value is 0 and j value is 0
C. i value is 1 and j value is undefined
D. i and j value are undefined