im trying to use an if statement on a string. is there a way that if i say scanf("%s", &user) that i can then proceed to say if (user== quit) then....... 'quit' doesnt work because that is for characters any ideas?
im trying to use an if statement on a string. is there a way that if i say scanf("%s", &user) that i can then proceed to say if (user== quit) then....... 'quit' doesnt work because that is for characters any ideas?
Use strcmp()
> scanf("%s", &user)
If you have a char array, then drop the &, you don't need it.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
i am scanning in as an array using a for loop, i just said scanf for simplicity.... strncmp compares two strings im trying to see if the word that was entered by the user is "quit" should i use strncmp and define quit up above main?
nevermind im retarded, i got it