0
c, basic concepts, input & output, second example with 'gets()' not running
The second example with gets() is not running. What do I have to enter?
5 Answers
+ 1
I'm sorry I can't understand your question. Where's this first example you are talking about?
+ 1
The code works but you get a warning.
You can read here about gets() vs fgets() vs scanf():
https://stackoverflow.com/questions/3302255/c-scanf-vs-gets-vs-fgets
0
This is the code (second example in the course) (sorry I don't know yet how to make comments in c):
#include <stdio.h>
int main() {
char a[100];
gets(a);
printf("You entered: %s", a);
return 0;
}
0
It works. What it shows are warnings. To suggest you that using fgets() instead of gets(). gets() is working.