Hi. I am new in programming world. Currently I am learning C programming language, I want to about what is Command Line Arguments? What are its uses? Where we have to use this? If you are having any suggestions then reply me. It can helpful to me.
Hi. I am new in programming world. Currently I am learning C programming language, I want to about what is Command Line Arguments? What are its uses? Where we have to use this? If you are having any suggestions then reply me. It can helpful to me.
Command line arguments are those which can be passed to the main method as parameters and use those values in the main method before executing it. Try to understand the following example. It is very simple.
Code:#include <stdio.h> main( int argc, char *argv[] ) { if( argc == 2 ) printf("The argument supplied is %sn", argv[1]); else if( argc > 2 ) printf("Too many arguments supplied.n"); else printf("One argument expected.n"); }
Bookmarks