#include #include #include int main(int argc, char *argv[]){ printf("Number of args: %d\n",argc); // This section of code assumes that the first two command // line arguments are ints, adds them, and prints the answer. int answer; if(argc >= 3){ // make sure there are three arguments answer = atoi(argv[1]) + atoi(argv[2]); printf("%d + %d = %d\n",atoi(argv[1]),atoi(argv[2]),answer); } // This section of code copies the first argument (which will be ./a.out) // into a string and prints it one character at a time. int c = 0; char str[100]; strcpy(str,argv[0]); // copy argv[0] while(str[c] != '\0'){ printf("%c\n",str[c]); c++; } }