I need help. My program is starting with: ./proj --tan 1.024 6 10 I count tangens through Taylor' s polynom. Range of iteration is 1 to 13. I need to stop program if nuber of iteration is higher then 13, but my code below don't work.
if ((sscanf(argv[3], "%d", &n) >= 14) || (sscanf(argv[3], "%d", &n) < 0)) { return ERROR_WRONG_NUM; } if ((sscanf(argv[4], "%d", &m) >= 14) || (sscanf(argv[4], "%d", &m) < 0)) return ERROR_WRONG_NUM;
sscanfreturns the number of items that were successfully scanned, not the value that was scanned. You should callsscanfonce, and then compareif (n >= 14 || n < 0).