command line arguments
command line arguments
command-line arguments allow users to pass information to a program at runtime via the command
line. These arguments are passed to the program's main function as parameters.
The main function in C++ can take the following form to handle command-line arguments:
Syntax
Parameters
An integer that holds the number of command-line arguments passed to the program.
Includes the name of the program as the first argument, so argc is always at least 1.
Example Program
#include <iostream>
using namespace std;
return 0;
}