C examples for Function:main function
Accessing command-line arguments.
#include <stdio.h> int main(int argc, char *argv[]) { int count;/*from w w w.j a v a 2 s . com*/ printf("Program name: %s\n", argv[0]); if (argc > 1) { for (count = 1; count < argc; count++) printf("Argument %d: %s\n", count, argv[count]); } else puts("No command line arguments entered."); return 0; }