Passing arguments

How to pass arguments into a C program with the command line.

Pass arguments in C.

Date Created:Friday May 11th, 2007 10:35 AM
Date Modified:Sunday August 03rd, 2008 12:40 PM

#include <stdio.h>

int main(int argc,char argv[])
    int i;
    for (i=0argci++)
        printf("\n%s is arg[%d]"argv[i],i);
    return 0;

Download: test.c 151 B

Please login or Click Here to register for downloads
Creative Commons License
Passing arguments by Dan Lynch
is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 3.0 United States License
Based on a work at
Permissions beyond the scope of this license may be available at