hi guys, how can i use strcmp function to compare an amount of char array like a[0][0] with a char like "*"?
i tried to use it like this but it shows error:
a array will be taken from the user
"*" is not a char. it is a string. '*' is a char. strcmp does not compare chars. It compares c-strings.
If you need to compare specific char on specific position, do it directly: if( a[0][0] == '*')
If you need to compare strings, then compare strings (c-string is a character array, you have array of char arrays aka array of c-strings) if( strcmp(a[0], "*") == 0 )