The program below has a bug. Which statement correctly describes it?
#include <stdio.h>
int main(void) {
int n = 0;
scanf("%d", n);
printf("%d\n", n);
return 0;
}
scanf is variadic, so the compiler can only warn. At run time it treats 0 as a pointer and writes through it. Write scanf("%d", &n) and check that it returns 1.