I’m trying to compare a character string with the argv argument.
I have this in my main:
int main(int argc, char *argv[])
Now if I write
if (argv[2] == 'squared')
the IDE tells me that I have a multiple character constant or that the char* is too long for its type or something similiar.
Is there a way to compare argv to a character string? I’ve even used strcmp but that gives me a segmentation fault when the program runs.
I also tried a for loop and incremented argv[i] but that gave me an error too.
Maybe I’m missing something?
Use strcmp and a real string, not a multi character constant.