Command Line Argument:-
It is possilbe to pass some arguments to main function also, the argument pass to main function are nothing but Command Line Arguments. These argument are passed from command prompt.
To pass command line argument, you need to modify main() function as given below.

void main(int argc, char *argv[] )
Here, argc counts the number of arguments. It counts the file name as the first argument.
The argv[] contains the total number of arguments. The first argument is the file name always.
Example

#include<stdio.h>
#include<conio.h>
void main(int argc, char *argv[] )
{
printf("Program name is: %s
", argv[0]);
if(argc ==1 )
{
printf("No argument passed through command line.
");
}
else
{
printf("First argument is: %s
", argv[1]);
}
}
Run this program as follows in Windows from command line:
myprogram.exe CFunda
Output:
Program name is: program
First argument is: CFunda
If you pass many arguments, it will print only one.
./program CFunda is app
Output:
Program name is: CFunda
First argument is: hello
But if you pass many arguments within double quote, all arguments will be treated as a single argument only.
./program "CFunda is app"
Output:
Program name is: program
First argument is: CFunda is app
You can write your program to print all the arguments. In this program, we are printing only argv[1], that is why it is printing only one argument.