Search Contact information
University of Cambridge Home Department of Engineering
University of Cambridge >  Engineering Department >  computing help
next up previous contents
Next: Using qsort, random numbers Up: Examples Previous: Examples   Contents

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 %d arguments are\n", argc);
   for (i=0; i<argc; i++)
       printf("%d %s\n",i, argv[i]);
   exit (0);

Tim Love 2010-04-27