Using char array/string to get out of while loop

hi! I have been picking up c programming for 2 weeks thus far. I am currently stuck in a while loop while using string and char array to get out of the loop. Please help!

char input[80];
char checker[] = "wrong";
printf("type smth");
scanf("%s",&input);

while ((strcmp(checker,"correct")||(stricmp(inputMath,"quit")))
{
/* remove code but somewhere inside here I replace the value of
variable checker from "wrong" to "correct" */
printf("type smth");
scanf("%s",&input);
}

is the while statement valid?

Comments

  • i'm not so sure about this but i think '&' can not be used for string variables while using scanf() function.

    scanf ("%s",[b]input[/b]);
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion