Skip to content

Command-Line Arguments#

The main function take optionally take arguments when invoked:

int main(int argc, char *argv []);

The first parameter (argc) contains the number of arguments passed, while the second parameter (argv) is an array of strings which stores the parameters themselves. The first command-line argument is always the path through which the program was invoked.