requirements for argv in c code example

Example 1: command line arguments in c

int main( int argc, char *argv[] )
./a.out kiran kumar gun
./a.out is arg[0]
kirna is arg[1]

Example 2: giving arguments to main function in c

/* main.c */
/* 0 copyright/licensing */
/* 1 includes */
/* 2 defines */
/* 3 external declarations */
/* 4 typedefs */
/* 5 global variable declarations */
/* 6 function prototypes */

int main(int argc, char *argv[]) {
/* 7 command-line parsing */
}

/* 8 function declarations */

Tags:

Cpp Example