/* * Program to echo command-line arguments. * (Also checks whether they're integers.) */ #include #include int main(int argc, char *argv[]) { for (int i = 0; i < argc; ++i) { printf("arg %d is %s\n", i, argv[i]); char * endptr; int n = strtol(argv[i], &endptr,10); if (*endptr == '\0') printf("an integer %d\n", n); } return 0; }