ghasem_008
Full Member level 4
error in c language : gets() after scanf()
hi.
As you know,there is a problem in c programming language,when gets() comes after scanf().
in this case, first gets() after scanf() doesnt work.in fact the first gets() see Enter ("\r") and skip.
i used from an extra gets() to ignore this prblem.
for example:
in the above, I used from [char s2[]={'\0'}; gets(s2);] to ignore scanf effect on gets().
is there any better solution (with basic commands only.I dont want to use from librarian functions)?
hi.
As you know,there is a problem in c programming language,when gets() comes after scanf().
in this case, first gets() after scanf() doesnt work.in fact the first gets() see Enter ("\r") and skip.
i used from an extra gets() to ignore this prblem.
for example:
in the above, I used from [char s2[]={'\0'}; gets(s2);] to ignore scanf effect on gets().
is there any better solution (with basic commands only.I dont want to use from librarian functions)?