How to compare the string in if con | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to compare the string in if con

I want it to show ye when I input 1 but its always show nee

5th Nov 2019, 10:50 AM
Pubas Deedumrong
Pubas Deedumrong - avatar
2 Answers
+ 1
"==" checks if both strings are pointing to same address. You can use strcmp to compare two strings. if(strcmp("hi", "hi") == 0) { }
5th Nov 2019, 11:20 AM
Jakub Stasiak
Jakub Stasiak - avatar
5th Nov 2019, 10:51 AM
Pubas Deedumrong
Pubas Deedumrong - avatar