+ 1
HELP ME !!!
When i code , char decision[100]; And then scanf("%s", decision); and then i code if( decision == "yes") { goto back;} else if( decision == "no") { exit(0);} When i run this code, the code ia not working why? Please give me some solutions!
5 Respostas
+ 3
You are using C type strings here so my answer will be C based. You can't make direct string comparisons like this. You should use strcmp(str1, str2) from the string.h library. Review strings in the C tutorial.
https://www.sololearn.com/learn/C/2937/
+ 2
Can you add full code?
+ 1
Arrays in c are pointers actually so it you compare with a string literals.. Use strcmp function. You can see explanation in above link...
Like if(!strcmp(decision, "yes"))
Add string.h library
0
Wait sir