📄 atoi.c
字号:
/* Implementation module : atoi.c
Copyright 1989 Diab Data AB, Sweden
Description :
Implemention of libc function
int atoi(const char *);
History :
When Who What
890307 teve initial
*/
/************** Imported modules ********************************/
#include <stdlib.h>
#include <ctype.h>
/************** Local data, types, fns and macros ***************/
/************** Implementation of exported functions ************/
int lib_atoi(const char *nptr)
{
int i, c, neg = 0;
while(isspace(c = *nptr++)) ;
switch(c) {
case '-':
neg = 1;
/* fall through */
case '+':
c = *nptr++;
break;
}
i = 0;
while(isdigit(c)) {
i = i*10 + c - '0';
c = *nptr++;
}
if (neg) return -i;
return i;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -