Pregunta de entrevista de Indiegogo

Write the base C function atoi(char* string) without using the built in transformation functions.

Respuesta de la entrevista

Anónimo

5 jul 2019

int atoi(const char* string) { int res = 0; while (*string) { res = res * 10 + (*string) - '0'; ++string; } return res; }

1