take a look at this piece of code...
if the sentinel value is 0 it seems that getchar() takes
int main( void )
int i = 0, c = 0, sent = 0;
char str[ 30 ];
printf( "Choose ( 0 to this, 1 do that ) : " );
scanf( "%d", &sent );
if( sent )
;/* do stuff */
printf( "Please input a string of text : \n" );
while( ( c = getchar() ) != '\n' )
str[ i++ ] = c;
str[ i ] = '\0';
printf( "The string entered was : \n" );
puts( str );
the newline char that i inputed in order to scanf() the sentinel
I thought that scanf() doesn't leave the newline char in stdin,
so that i don't have to fflush() it.
Any comments on that ?