I want to initialize/set char *argv[] inside the main() so that I can use argv[1], argv[2]... later in my program.
Up to now, I know how to do this in two ways:
- For - int main(), use one line as:- int main() { char *argv[] = {"programName", "para1", "para2", "para3", NULL}; }- Note that, using - NULLin the end is because the pointers in the- argvarray point to C strings, which are by definition- NULLterminated.
- For - int main(int argc, char* argv[]), I have to use multiple lines as:- int main(int argc,char* argv[]) { argv[0] = "programName"; argv[1] = "para1"; argv[2] = "para2"; argv[3] = "para3"; }
My question is that how can I combine these two methods together, i.e. use only one line to initialize it for int main(int argc, char* argv[])? Particularly, I want to be able to do like this (this will be wrong currently):
int main(int argc, char* argv[])
{
    argv = {"programName", "para1", "para2", "para3", NULL};
}
How can I be able to do this?
Edit: I know argv[] can be set in Debugging Command Arguments. The reason that I want to edit them in main() is that I don't want to bother to use Debugging Command Arguments every time for a new test case (different argv[] setting).  
 
     
     
     
     
    