int myatoi(char*str) { int ret = 0; int sign = 1; if(*str =='-')
sign =-1; else
ret = ret *10 +(*str -'0');
str++; while(*'\0') {
ret = ret *10 +(*str -'0');
str++; }
return sign*ret; } void main() { char*mystring ="123"; int i = myatoi(mystring); printf("i value:%d\n",i);
getch(); }