Solution for Exercise 15-3

ex1503

#include <stdio.h>

int main(int argc, char *argv[])
{
    printf("You typed %d arguments.\n",argc);
    printf("Argument one is %s.\n",argv[0]);
    return(0);
}

Output

You typed 1 arguments.
Argument one is ./a.out

Notes

* argv[0] is always the name of the program running.