Why we are not recommanded to use fflush(stdin)?
What diffecent between gets() and scanf()?
Why we are not recommanded to use fflush(stdin)?
What diffecent between gets() and scanf()?
fflush(stdin)
scanf() inputs a formated string, gets() only inputs a string.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
Gets will allow someone to overwrite memory you have allotted. Try to use fgets instead. There are quite a few posts on this. Example:
Code:char this[15]; fgets( this, sizeof( this ), stdin ); //stdin used here is the standard input but could also be a file..etc
>Why we are not recommanded to use fflush(stdin)?
Search for fflush ( stdin ) and posts by Prelude.
>What diffecent between gets() and scanf()?
scanf can be used safely if also used with discipline. There's no safe way to use gets.
-Prelude
My best code is written with the delete key.