I have this issue where gcc using the Werror argument, comes up with the error 'ignoring return value of scanf'. Now, I checked the forums and I did do stuff such as putting it in an if statement which seemed to work fine, but the thing is, I do not get the error if I were to compile it at my University.
#include <stdio.h>
#include <stdlib.h>
#define EXAMPLE1 5
int main (int argc, char* argv[]) {
int example;
scanf ("%d", &example);
if (example <= EXAMPLE1) {
printf ("Woohoo\n");
} else {
printf ("Oohoow\n");
}
return EXIT_SUCCESS;
}
So this code for example would compile fine using gcc -Wall -Werror -O -o namehere namehere.c at my uni, but if I were to use it at home, the aforementioned error comes up. My uni is using gcc 4.9.2. I tried it at home on gcc 4.8.4, 4.8.5, 4.9.3.