[Solved] Compare char array [closed]


Assuming that CDdata[i].artist and search are char* or const char*, all you’re currently doing is comparing the pointers not the values.

You need to use something like if (strcmp(CDdata[i].artist, search)) which will return 0 for equality.

strcmp is a standard function in the C standard library.

solved Compare char array [closed]