Command Line Argument in C

#include
int main(int argv,char *argc[])
{
clrscr();
printf("%s",argc[1]);
printf("\nNo. of arguments %d",argv);
return 0;
}

Here
argv - argument vector
argc - argument character

for execution
compile the above program now it will generate an EXE file
of that program

now in turboc
goto dos shell(File->Dos shell)
type the name of the program and some argument
Example: MyProgram Kunal

The output will be
Kunal
No. of arguments : 2

Comments

Popular posts from this blog

How to set background color of navigation bar in iPhone

Checking Device Info in ios

Some Interactive tips to take input form GUI Dialogs