Code:
#include <stdio.h>
int main( void )
{
int Ivar;
printf( "Enter:" );
scanf( "%c", &Ivar ) ;
while ( Ivar != EOF )
{
printf( "\nValue == %d\n", Ivar );
printf ( "ANSI = %d, Char = %c", Ivar, Ivar );
printf( "\nEnter:" );
scanf( "%c" , &Ivar );
}
system( "pause" );
return 0;
}
The output of the Code is
Enter:s
Value == 115
ANSI = 115, Char = s
Enter:
Value == 10
ANSI = 10, Char =
Enter:
This is what it prints out . The First sanf works fine . It does what I want it to do . it disoklays the ANSI Value of the Character I typed in . But the scanf in the loop executes without halting for an Input ?
I would like to know why and how is this problem occurring . Is this a Inheret C problem ?
Thanks