Problems with character input
I need help with understanding how to recieve single character input, and use it the correct way.
This book I'm learning from is kind of shakey on this subject, and mainly goes into strings of input using strcmp, gets and puts, and what not.
So strings are not my problem, just single characters.
This is pretty much what I know now...
Code:
#include <stdio.h>
void main()
{
char first;
char second;
printf("Enter a letter:");
scanf("%c", &first);
printf("Enter another letter:");
scanf("%c", &second);
printf("%c %c", first,second);
}
When i run it, it asks for the first letter, and i input it. But then it skips the next scanf, and sets the letter i put for the previous scanf, into that one.
I'm seeing functions like "getchar" and "putchar", and other ones such as "toupper", "tolower". But the book doesn't describe how to use them.
Please help, this is driving me insane.