int main(void)
{
int i, j, k;
scanf("%d%d%d", &i, &j, &k);
printf("%d %d %d", i, j, k);
return 0;
}
If you enter 1,2,3, what will happen? And why?
According to https://stackoverflow.com/a/1681826/ ... if it scanf()reads an unexpected row, it will return early without changing the value after the last successful value.
I tried clang (LLVM 6.1.0), -O0the above explanation is correct, but the -O2second variable is always a random number, but not the same as before scanf(), and the Third variable is always 0.
source
share