#include <stdio.h> 
#include <stdlib.h> 

/****
 *
 * Read command-line arguments and convert them to ints.  Invoke this program
 * from the terminal like this, for example:
 *
 *     cmd-line 10 20 30
 *
 * assuming that the program has been compiled with "gcc ... -o cmd-line".  The
 * output with this invocation is this:
 *
 *     arg[1] = 10
 *     arg[2] = 20
 *     arg[3] = 30
 *
 */

int main(int argc, char** argv) {
    int i;
    int val;
    char* arg;

    for (i = 1; i < argc; i++) {

        arg = argv[i];
        val = atoi(arg);
        printf("arg[%d] = %d\n", i, val);

    }

    return 0;
}