#include #include #include #define EXIT_ERROR -1 extern int errno; int example(int,int); int main(int argc, char *argv[]){ int arg1,arg2,ret; /*argv[1] should be a number*/ if(argc != 3){ printf("Usage: %s inputNumber1 inputNumber2\n",argv[0]); return EXIT_ERROR; } arg1 = strtol(argv[1],NULL,10); if(errno == ERANGE || errno == EINVAL){ fprintf(stderr,"ERROR:You must enter a valid integer\n"); return EXIT_ERROR; } arg2 = strtol(argv[2],NULL,10); if(errno == ERANGE || errno == EINVAL){ fprintf(stderr,"ERROR:You must enter a valid integer\n"); return EXIT_ERROR; } ret = example(arg1,arg2); printf("example(%d,%d)=%d\n",arg1,arg2,ret); return ret; } int example(int arg1,int arg2){ int a,b,c; a = arg1 *2; b=15213; c = arg2 + b; b = b + a; b = b + c; a = arg1 * arg2; return (b >> 2) + a; }