I understand that fgets is better to use than scanf. I am new at using it. Could someone explain what the purpose of "stdin" is when you use fgets?
Example:
char car [10];
printf ("\nEnter type of car");
fgets(car, sizeof(car), stdin);
Thank you
Printable View
I understand that fgets is better to use than scanf. I am new at using it. Could someone explain what the purpose of "stdin" is when you use fgets?
Example:
char car [10];
printf ("\nEnter type of car");
fgets(car, sizeof(car), stdin);
Thank you
scanf defaults to get data from standard input stream, while fgets lets u specify a stream. In this case, stdin means the standard input stream.
Thank you :)