On 26 Jun, 02:15, pete <pfil...@mindspring.comwrote:
Fred Yu wrote:
"Mariano" <mariano.calan...@gmail.com>
:8a82a41a-1992-4fa3-9c9b-bc4f6c2b3...@e39g2000hsf.googlegroups.com...
I have this lines:
char *chr;
int integ;
num[0] = '1';
num[1] = '9';
How I could obtain value 19 in the integ variable????
Hi to all.
integ = atoi(num[0])*10+atoi(num[1]);
That's wrong.
num[0] is not a pointer to a string.
and num may not be a valid string, we don't
know if there's a terminating nul character
atoi takes a pointer to a string as an argument.
and has poor error handling
int atoi(const char *nptr);
--
Nick Keighley