if i set the char array as a 2d array, how can i get the string from the user
i have tried to use 'gets', but when i compiled it, there is syntax error..
if i set the char array as a 2d array, how can i get the string from the user
i have tried to use 'gets', but when i compiled it, there is syntax error..
i wanna ask what is stdin??
also, if i dont use fgets, can i have another way to get the string?
>>also, if i dont use fgets, can i have another way to get the string?<<
You can also use getchar() to read one byte at a time, but why bother when fgets() does a fine job.
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]
I dont know why salem said like this:
>If you're thinking of using gets(), then forget it
I tried something like this:
Code:main() { char strings[10][20]; int i; for(i=0;i<=9;i++) { gets(strings[i]);//a point to be noted is entering char <= 20 } for(i=0;i<=9;i++) { puts(strings[i]); } }
Saravanan.T.S.
Beginner.
You don't know because you obviously didn't read the FAQ link that Salem provided. Honeslty though, I don't know why I bother providing the same link. You didn't read it the fist time, why should now be any different?Originally posted by saravanan_ts
I dont know why salem said like this:
>If you're thinking of using gets(), then forget it
I tried something like this:
Quzah.
Hope is the first step on the road to disappointment.
Thanks quazah
Saravanan.T.S.
Beginner.