Toggle navigation
Home
Latest pastes
FAQ
Random
BitBin is shutting down!
Register
Login
my_getnbr.c
SUBMITTED BY:
Guest
DATE:
Nov. 29, 2013, 6:39 p.m.
FORMAT:
Text only
SIZE:
523 Bytes
Raw
Download
Tweet
HITS:
1392
Go to comments
Report
int my_getnbr(char *str)
{
int nb;
int neg;
nb = 0;
neg = 1;
while (*str == '+' || *str == '-')
{
if (*str == '-')
neg = neg * -1;
str = str + 1;
}
while (*str != '\0')
{
if (*str >= '0' && *str <= '9')
{
nb = nb * 10;
nb = nb + *str - '0';
str = str + 1;
}
else
return (nb * neg);
}
return (nb * neg);
}
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus