I am trying to compare strings in C with the following code
int strcmp ( const char * str1, const char * str2 );
if (strcmp(name, "Tom") == 0)
printf("You're not Tom!");
However, it will always print “You’re not Tom!” even when I input “Tom” which is confusing. Did I make a mistake?
What is this? You should need an import to get this function.
Hi sorry, I’m not really familiar with C, but when I google stuff out, some forums say that I should be using a function like that so I tried running it, and the result is as shown. I’m still new to C so I haven’t gotten to importing stuff yet
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.