If you want your program to be able to process command line arguments you must tell the compiler to be ready to retrieve the command line arguments by adding arguments to main().
1 2 3 4
int main(int argc, char **argv)
{
// The code for main().
}
The first argument will be the count of the number of arguments that you entered on the command line when starting the program, the second argument will be an array of C-strings.
So if you run your program like yourProgram YourFirstName YourSecondName YourAge argc will have a size of the number of arguments (in this case 4), and note that argv[0] is normally the name of the program being run and argv[argc + 1] is guaranteed to be a nulptr.