-
comparing problem
i have an array of a structure called video which has a field catagory, im serching the array and comparing the user enterd catagory to the one in the data structure, but even if they are the same it does not recognise it, the comparing code is:
if(video[i].catagory == usercat)
i have even printed out the values at this point and they look identical, but it fails to work, any ideas??
-
How are the category member and usercat variable declared, not strings I hope, if they are you cannot use the "==" operator, use strcmp().
-
char arrays (dothese count as strings??)
-
char arrays are strings, yes therefore...
if(video[i].catagory == usercat)
should be...
if(!strcmp(video[i].catagory, usercat) )