Pass Arguments to a Program from the Command Line - C Function

C examples for Function:main function

Description

Pass Arguments to a Program from the Command Line

Demo Code

#include <stdio.h>

int main(int argc, char *argv[])
{
     int i;//  ww  w .j a  va 2s  .c  om
     printf("P: %s district:\n", argv[1]);
     for(i = 2; i < argc; i++)
         printf("%s\n", argv[i]);
     return(0);
}

Related Tutorials