Input Buffer problem.
Okay, for example I have this code,
And when I run the code,
/* Case 1 */
printf("\nLetter: %d", str);
/* Case 2 */
printf("\nLetter: %d", chr);
On case 1: the str has value of the first character of whatever you inputted.
On case 2: the chr has value of LineFeed (ASCII 10).
Now for my question,
Why on case 1 the str does not take the LineFeed character ?
Whereas on case 2, the chr takes the LineFeed character ?
Aren't both string and character supposed to take everything inputted into them?
I hope you get my meaning..
%s reads the next non-space sequence of chars, skipping any leading spaces, tabs and newlines
%c reads the next char
Hmm, I see, I didn't know that.
But anyway, thanks for your reply. :)