/* Example taken from http://www.ihypress.net/programming/c/prog.php?chap=12&pgm=02 This program accepts two arguments in a specific order: 1) an integer number 2) a double number and sums them up */ #include #include int main (int argc, char *argv[]) { int a; double x, sum; if (argc == 3) { printf("The arguments supplied are %s and %s.\n", argv[1], argv[2]); a = atoi (argv[1]); /* convert string to integer */ x = atof (argv[2]); /* convert string to double */ sum = a + x; printf ("The sum is: %f\n", sum); } else if (argc > 3) printf ("ERROR: Too many arguments supplied.\n"); else printf ("ERROR: One argument expected.\n"); return (0); }