Home > Programming > Functions using the "C" programming language > example26.c

 

Previous

Next


/*
    In this example we demonstrate the main() function when it has parameters.
*/
#include <stdio.h>
#include <conio.h>

/*
    This program prints it's command line parameters.
    Note that function main() parameters can be declared only as shown here, ie the
    only parameters available are the number of command line arguments and the arguments array.
*/

void main(int argc, char *argv[])
{
    int i;
    for(i=1; i<argc; i++)
        printf("Argument %d is %s.\n",i,argv[i]);
    getch();
}


© 2004 Jim Valavanis

Previous

Next

1