I noticed today that sometimes when I use the gets function my compiler simply ignores it. OK. This is an example where gets works:
#include <stdio.h>
void main()
{
char s[50];
gets(s);
puts(s);
}
Now if I make this simple change to my program, the function gets is ignored:
#include <stdio.h>
void main()
{
int n;
printf("dati n:\n");
scanf("%d",&n);
char s[50];
gets(s);
puts(s);
}
"ignored" means that when i run the program the compiler reads the variable and then quits without reading my string. Why does that happen? Thank you.