- int my_getnbr(char *str)
- {
- int result;
- int mult;
- result = 0;
- mult = 1;
- while (*str > '9' || *str < '0')
- mult = (*str++ == '-') ? (0 - mult) : (mult);
- while (*str == '0' && *(str + 1) <= '9' && *(str + 1) >= '0')
- str++;
- while (str[++result] <= '9' && str[result] >= '0')
- mult *= 10;
- result = 0;
- while (mult != 0)
- {
- result += (*str++ - '0') * mult;
- mult /= 10;
- }
- return (result);
- }
Posted by Anonymous on Thu 1st Nov 05:35 (modification of post by view diff)
download | new post
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.