I am having a problem with getchar().
How do i avoid getchar() reading the \n character.
I have this little code
do
{
printf("Enter a number no larger than |32767|\n");
num = convert();
if(num < 32768 && num > -32768)
printf("%d",num);
else
printf("-32768");
printf("\nAgain? 1 = yes, 0 = no\n");
}while((answer = getchar()) == '1');
so when the user enters a 1, the program restarts, but the problem is that in the function convert(), getchar reads the newline character '\n'. And what i want it to do get new input from the user not the old input from the Again? question.
Please help