GeSHi (c):
char ans;
int ret;
scanf ("%c", &ans);
ret = ans - 'y'Created by GeSHI 1.0.7.18
does exactly the same thing, without overflow.
but
GeSHi (c):
if (ans == 'y')Created by GeSHI 1.0.7.18
is considered more correct.
or
GeSHi (c):
switch ans
{
case 'y':
/*code here*/
break;
}Created by GeSHI 1.0.7.18
the only overflow is going to be in the scanf statement, which still is in your code adeyblue. checking a char against a char or array will not result in overflow. just possible unpredictable results.