I tried the atoi function but it keeps going until it's not an int.
for example
would give me 12, but I need one.Code:char s[5] = "12a12"; int p=atoi(&s[0]);
I tried the atoi function but it keeps going until it's not an int.
for example
would give me 12, but I need one.Code:char s[5] = "12a12"; int p=atoi(&s[0]);
s[0] - '0' will give the int value for characters in the range '0' - '9'
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
thnkx