Commit 47aa9265 authored by Amitha Perera's avatar Amitha Perera
Browse files

BUG: the return value of scanf should not be ignored

parent 26c7a187
......@@ -70,7 +70,11 @@ int main(int ac, char *av[])
printf("To run a test, enter the test number: ");
testNum = 0;
scanf("%d", &testNum);
if( scanf("%d", &testNum) != 1 )
printf("Couldn't parse that input as a number\n");
return -1;
if (testNum >= NumTests)
printf("%3d is an invalid test number.\n", testNum);
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment