Explain how to test this code, write atoi, etc
Anonymous
int my_atoi(char * string) { int numArr[10]; int val = 0; int numChars = 0; while(*string) { if(*string >= '0' && *string <= '9') { numArr[numChars++] = (*string++) - '0'; } else string++; } for(int i = 0; i < numChars; i++) { val += numArr[i] * (int) pow(10,numChars - i - 1); } return val; }
Check out your Company Bowl for anonymous work chats.