Home Segments Index Top Previous Next

597: Mainline

Assembling the type specifications and parameters into main, you have the following demonstration program, which just displays the name of the program and the argument, which is presumed to be a file specification:

#include   
main (int argument_count, char **argument_array) { 
  printf ("You have supplied %s to %s.\n", 
                             argument_array[1], 
                                   argument_array[0]); 
} 

Accordingly, if the name of the demonstration program is demonstration_program and you type the command line demonstration_program file_name.extension, you obtain the following result:

You have supplied file_name.extension to demonstration_program.