两种方法实现字符串转换为数字
函数声明int atoi(char * p);假如p=“5678”;函数的返回值就是5678用两种方法实现函数请高手解答一下
其他答案
只做了正整数的情况,你看是不你想要的#include <stdio.h>#include <string.h>int String2Int1(char *pHead, char *pEnd){ int retVal=0;while (pEnd>=pHead) { retVal*=10;retVal+=*pHead-'0';pHead++;} return 展开
2011-01-18 10:35
来自北京市
赞(0)点赞赞(0)举报
免责声明:问答内容均来源于互联网用户,房天下对其内容不负责任,如有版权或其他问题可以联系房天下进行删除。




