/* * question8b.c = mainarg.c * FINAL * By: John Stile * Summery: takes arguments to the program, * print the number of argumesnt. * prints the name of the program. * print up to the fist 2 arguments if defigned. */ #include int main(int argc, char *argv[] ) // takes argumetns // stores number of args in argc // stores argumetns in char array pointer argv { printf("The number of real arguments is %d\n", argc); // print number of arguments printf("The first argument, using argv[0], is %s\n", argv[0]); // print name of program if(argc > 1) // print first argument to program if count is greater than 1 printf("The second argument, using argv[1], is %s\n", argv[1]); if(argc >2) // print second argument to program if count is greater than 2 printf("The third argument, using argv[2], is %s\n", argv[2]); return 0; }