You're comparing a two-char array (cat
), that is NOT initalized to any value (at least not in the code that you showed us), to a single char.
The strcmp
function accepts two arguments of type const char*
, that is two null-terminated c-style strings (a char array whose last element is a '\0' character, the null character).
If you want to compare just one character, use the following code:
char cat = ; // Put the character you want to compare styleAr[x].category against there.
for (int x = 0 ; x < size; x++)
{
if (cat == styleAr[x].category)
{
// The two characters are equal.
}
}