📄 atoi.c
字号:
#if !defined(lint) && defined(SCCSIDS)static char sccsid[] = "@(#)atoi.c 1.1 92/07/30 SMI"; /* from S5R2 2.1 */#endif/*LINTLIBRARY*/#include <ctype.h>#define ATOI#ifdef ATOItypedef int TYPE;#define NAME atoi#elsetypedef long TYPE;#define NAME atol#endifTYPENAME(p)register char *p;{ register TYPE n; register int c, neg = 0; if (!isdigit(c = *p)) { while (isspace(c)) c = *++p; switch (c) { case '-': neg++; case '+': /* fall-through */ c = *++p; } if (!isdigit(c)) return (0); } for (n = '0' - c; isdigit(c = *++p); ) { n *= 10; /* two steps to avoid unnecessary overflow */ n += '0' - c; /* accum neg to avoid surprises at MAX */ } return (neg ? n : -n);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -