
最近偶看书遇见一个C程序 就是不懂什么意思,有谁可以解决一下?^0^
#include<stdio.h>
int getch(void);
void ungetch(int);
/*getin函数:将输入中的下一个整型数值赋值给*pn */
int getint(int *pn)
{
int c sign;
while (isspace(c =getch())); /*跳过空白符 */
if (!isdigit(c) && c != EOF && != ''''+'''' && c!= ''''-'''') {
unfetch(c); /*输入不是一个数字 */
return (0);
}
sign = (c == ''''-'''') ? -1:1;
if (c == ''''+'''' || c == ''''-'''')
c = getch();
for (*pn = 0; isdigit(c); c = getch())
*pn = 10 * *pn + (c - ''''0'''');
*pn *= sign;
if (c != EOF)
ungetch(c);
ruturn c;
}
拜托了大家,帮帮忙啊!!!
自:Bbs.Faloo.com ------------------------------ [复制本帖地址] //bbs.faloo.com/t/7965.html
|
|