[Cexpert-001] How to implement atoi with least codes using C language?
It'ssooooeasy,Ithink.#include
intatoi(unsignedchar*str)
{
intnum=0;
while(*str>='0'&&*str<='9')num=num*10+*str++-'0';
returnnum;
}
intmain(void)
{
printf("%d\n",atoi("12345"));
return0;
}Soeasy,righ