Command line Arguments In C

A typical C program normally executed by specifying run option within a menu driven environment. Some compilers also allow executing a program by specifying the name of the program at the operating system level, where the program name is interpreted as command.
Hence ,the line in which it appears is referred to as command line. Sometimes it is useful to pass information into program at the time of its run. Generally this information is passed to main() function via command line arguments.


Accessing command line arguments

There are two special built-in arguments, argc and argv . The parameter argc, is a integer type, which will hold the number of arguments passrd as arguments to the command line. Its value always atleast 1, because the name of the program treated as one of the arguments in the command line arguments. The parameter argv is an character array of pointers to the command line arguments . Each element of the array points to a command line argument.



About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext