Command Line Arguments in C

C Program to access Command Line Arguments.

Source code :

#include <stdio.h>

int main(int argc, const char *argv[]){
    
    int i;
    
    printf("There are %d arguments",argc);
    
    for( i = 0 ; i < argc ; i++){
        printf("
Argument %d : %s",i,argv[i]);
    }

    return 0;

}

Output :

There are 2 arguments
Argument 0 : test
Argument 1 : hello

Output :


                

Comments :