How can I convert a string to an array without using atoi
, atol
, isdigit
, anything like that?
Assume I have a const char *str
and a int *converted_val
as parameters.
Here's what I have:
const char *c;
for(c = str; (*c != '\0') && isdigit(*c); ++c){
*converted_value = *converted_value*10 + *c - '0';
}
return true;
but once again, I can't do it without isdigit. And I'm not sure how to handle strings that are large (for instance: "10000000000000000")