>I would like ths case (Number,Char) to be returned as an error.
It's usually better to handle such things gracefully. Returning an error is tantamount to saying "I can't fulfill my promise because something is stopping me". If you have the correct menu option, the function can fulfill its promise, so you have an unusual condition that should be handled, not an error.
However, if you really want to return an error, grab the next character after your number. If scanf returns a real error or the number is not valid you can die with an exception, otherwise everything is still kosher so you check the next character from the stream. If that character is a newline then everything is just fine. Otherwise there is extraneous data, which matches your error condition:
>I know fflush(stdin); is not the correct way to flush the input but i am willing to run with it.
int main ( void )
if ( scanf ( "%d%c", &i, &c ) != 2 )
printf ( "Some other error\n" );
else if ( i != 1 && i != 2 )
printf ( "Invalid option\n" );
else if ( c != '\n' )
printf ( "Extraneous input\n" );
printf ( "Good\n" );
That's your problem then. Just be sure to comment your use of it when posting code here so that we don't waste our time telling you something you already know but choose to ignore.