#include<ctype.h>#include<assert.h>intmy_atoi(const char*p){assert(p!=NULL);bool neg_flag=false;//符号标记int res=0;//结果if(p[0]=='+'||p[0]=='-')neg_flag=(*p++!='+');while(isdigit(*p)) res=res*10+(*p++-'0');return neg_flag?0-res:res;}