It is possible to pass some values from the command line to your Objective-C programs when they are executed.
These values are called command line arguments
The command line arguments are handled using main() function arguments where
- argc refers to the number of arguments passed,
- and argv is a pointer array, which points to each argument passed to the program.
It should be noted that argv holds the name of the program itself and argv is a pointer to the first command-line argument supplied and *argv[n] is the last argument.
If no arguments are supplied, argc will be one, otherwise if you pass one argument, then argc is set at 2.