Image

Programs - C Language - Command Line Arguments

Program:

#include <stdio.h>

int main(int arg, char* argv[]){
int n,i;
for(i=0;i<arg;i++)
  printf("\nargv[%d] = %s",i,argv[i]);
  
  return 0;
}

Output:


argv[0] = C:UsersApsMicrotechDocumentsUntitled1.exe
argv[1] = 111
argv[2] = 222
argv[3] = 333
argv[4] = 444
argv[5] = 555
argv[6] = hhhh