I have a char pointer returned from a function, and i want to double check its value using the IF statement how should i implement this one in C.
substring function from here
I want it something like this
if (substring("xxxNameYYY",0,3)=="xxx"){
//do this
} else {
//do that
}
the above if statement always go to “do that” part.
thanks
You cannot compare string like that in C, you have to use
strcmp(str1, str2) == 0to check if they are equal.In your case: