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?

3rd Apr 2020, 12:54 PM
andreas
5 odpowiedzi
+ 1
I'm sorry I can't understand your question. Where's this first example you are talking about?
3rd Apr 2020, 12:56 PM
Salman Nazeer
Salman Nazeer - avatar
+ 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
3rd Apr 2020, 1:18 PM
Denise Roßberg
Denise Roßberg - avatar
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; }
3rd Apr 2020, 1:05 PM
andreas
0
It works. What it shows are warnings. To suggest you that using fgets() instead of gets(). gets() is working.
3rd Apr 2020, 1:17 PM
你知道規則,我也是
你知道規則,我也是 - avatar