[Univ of Cambridge] [Dept of Engineering]
next up previous contents
Next: Using qsort, random numbers Up: Examples Previous: Examples

Command Line arguments

#include <stdio.h>
#include <stdlib.h>
/* This shows how args can be read from the Unix command line */
int main(int argc, char *argv[]){
int i;
   printf("The arguments %d are\n", argc);
   for (i=0; i<argc; i++)
       printf("%d %s\n",i, argv[i]);
   exit (0);

Tim Love