int main(int argc, char const *argv[]) {
if (argv[1] == '-n')
{
printf("Hello");
}
}
When I run this, I'm getting a "warning- comparison between pointer and integer" error. How do I fix this?
I checked that argv[1] contains -n by printing.
argvis an array of strings.'-n'is a multi-character constant, not a string. Not that you use==to compare strings anyway.