In C, we can supply arguments to 'main' function. The arguments that we pass to main ( ) at command prompt
are called command line arguments. These arguments are supplied at the time of invoking the program.
The main ( ) function can take arguments as: main(int argc, char *argv[]) { }
The first argument argc is known as 'argument counter'. It represents the number of arguments in the command
line. The second argument argv is known as 'argument vector'. It is an array of char type pointers that points to
the command line arguments. Size of this array will be equal to the value of argc.
Example: at the command prompt if we give:
C:\> fruit.exe apple mango
then
argc would contain value 3
argv [0] would contain base address of string " fruit.exe" which is the command name that invokes the program.
argv [1] would contain base address of string "apple"
argv [2] would contain base address of string "mango"
here apple and mango are the arguments passed to the program fruit.exe