I have a program written in C and the command I am supposed to run it with on linux looks like this:
./program --something X Y
What exactly does that mean? I think X Y will be the arguments so argc[2] will be X and argc[3] will be Y?
But what about --something?
Thanks a lot!
Advertisement
Answer
The C runtime does not discriminate any arguments, whether they start with -- or not. So you have,
argv[0] = "./program" argv[1] = "--something" argv[2] = "X" argv[3] = "Y" argv[4] = NULL
It is your program that assigns meaning to those values.