Create a function that returns the first character in the stream and then swallows the rest of the characters until the \n is encountered.
#include <stdio.h> char getch(void); int main()/*from w w w. j a va 2s .c o m*/ { char first,second; printf("Type your first initial: "); first = getch(); printf("Type your second initial: "); second = getch(); printf("Your initials are '%c' and '%c'\n",first,second); return(0); } char getch(void) { char ch; ch = getchar(); while(getchar()!='\n') ; return(ch); }