I am trying to write a C code which takes arguments in main; thus when I write some strings in cmd, the program doing somethings inside it. But I am doing something wrong and I can't find it.
This is the code:
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char * argv[]){ //File name is main.c
if(argc != 3)
printf("Wrong!!!!!!!!!");
else
if (argv[1] == "-s")
girls(); //Prints "Girls"
else if(argv[1] == "-k")
boys(); //Prints "Boys"
else
printf("OMG!!");
}
In the cmd;
gcc -o gender main.c
gender -s pilkington
I enter that commands. Bu the output is always
"OMG!!"
Which part is wrong?