Your function getCharOption is supposed to return a character, and your calling code test the return value to see if the check worked:
charValue = getCharOption("qwerty");
printf("////////////////////////////////////////\n");
printf("TEST #7 RESULT: ");
if (charValue == 'r')
{
printf("*** PASS *** \n");
}
else
{
printf("### FAILED ###\n");
}
printf("////////////////////////////////////////\n\n");
But there is no
return
statement in the getCharOption function at all:
char getCharOption(const char text[31]) {
char input;
int count = 0, i;
scanf("%c", input);;
clearStandardInputBuffer();
for (i = 0; text[i] != '\0'; i++) {
if (text[i] == input) {
count++;
}
if (count == 0) {
printf("ERROR: Character must be one of [qwerty]:");
}
}
So whatever it tested, it isn't valid data at all!
You should be returning 'r' for success, and something else for an error.
I'd also strongly suggest you read the instructions for your assignment again: you seem to have confused what you are supposed to do rather a bit - "qwerty" does not contain a "p", so at least one of your tests should fail!