Mega Code Archive

 
Categories / C / Code Snippets
 

A program to list the command line arguments

#include <stdio.h> void main(int argc, char *argv[]) { int j = 0; printf("Program name: %s\n", argv[0]); for(j = 1 ; j<argc ; j++) printf("\nArgument %d: %s", j, argv[j]); return 1; }