So far we have using main with an empty pair of brackets. But like any other function it is possible to pass argument or parameters to main when it starts executing i.e. at runtime. These arguments are called command line arguments because they are passed to main() from the command line during execution. main(int argc, char * argv[]) { ------- ------- } int argc: Argument count which is the number of command line arguments that are passed to function main(). char *argv[]: argument vector it is an array of pointer each pointing to a command line argument. i. The subscripts for argv[] are 0 to argc – 1. ii. argv[0] is the name of the executable file of the program (./a.out). It is not necessary to use the words argc and argv. Any other identifiers can be used. The arguments can have to be separated by white spaces. Example : Consider a program“Display.c” which displays the command line arguments on the ...
Engage with tech Interactives in fun way, Learn while having fun