I would like to write a program that performs different function based on the argument provided.
For example:
$ ./program -a //line 1
$ ./program -b //line 2
if I enter line 1 in terminal, I want it to print "Hi" if I enter line 2 in terminal, I want it to print "Bye"
Here is my current logic, which does not work in C:
int main (int argc, char *argv[])
{
if (argv[1] == "-a"){
printf("Hi");
} else if (argv[1] == "-b")
{
printf("Bye");
}
Can anyone help me fix my code in order to achieve my objective?
Thanks in advance!