#include <stdio.h>
int main() {
int a, b, c,d;
scanf("%d %d", &a, &b);
a=c;
b=d;
printf("a=%d\n", a);
printf("b=%d\n", b);
return 0;
}
This code reads two integers from the user into variables `a` and `b`, but then immediately overwrites those values by assigning `a=c` and `b=d`. Since `c` and `d` are uninitialized, the program prints unpredictable values.
- The assignments `a=c;` and `b=d;` are backwards. You want to store the input values into `c` and `d`, not overwrite `a` and `b` with garbage.
- The `scanf` reads into `a` and `b`, but then you never use those input values. Think about which variables should hold the input and which should be printed.