Passing arguments to main () function: Command line arguments: argc and argv

Information that follows a program’s name on the command line of the operating system is known as command line arguments. For Example:

cc program_name

Here, program_ name is a command line argument.

argc: argc is a built in argument that holds the number of arguments on the command line. argc is an  integer and it must be atleast 1.

argv: argv is a built in argument is a pointer to an array of character pointers and each element in this array points to a command line argument.


char *argv[];

Leave a Reply