COMMAND LINE ARGUMENTS
These are used to pass values from command prompt. There are two special parameter to main() namely
- argc
- argv.
argc means argument counter of type integer, that contains a value representing number of arguments sent.
argv is a argument vector array of type pointer to character array that stores the values of arguments. argv[0] always contains the name of the program and from arg[1] onwards the list of arguments sent from the user.
/*Wap to compare two words.*
#include < stdio.h >
#include < string.h >
main(argc,argv)
int argc;
char *argv[ ];
{
if(strcmp(argv[1],argv[2])==0)
printf(" \n Both are same");
else
printf(" \n Given words are not same");
}
Comments
Post a Comment