C程序设计语言习题5-1,运行时出现段错误,求解
源代码如下:
#include <ctype.h>
#include <stdio.h>
#define BUFSIZE 100
int getch(void);
void ungetch(int);
/* getint: get next integer from input into *pn */
int getint(int *pn)
{
int c, sign, sawsign;
while (isspace(c = getch())) /* skip white space */
;
if (!isdigit(c) && c != EOF && c != '+' && c != '-') {
ungetch(c); /* it's not a number */
return 0;
}
sign = (c == '-') ? -1 : 1;
if (sawsign = (c == '+' || c == '-'))
c = getch();
if (!isdigit(c)) {
ungetch(c);
if (sawsign)
ungetch((sign == -1) ? '-' : '+');
return 0;
}
for (*pn = 0; isdigit(c); c = getch())
相关问答:
#include <string.h>
#include <stdio.h>
void main()
{
int i;
char buf[]="abcde";
strncpy(buf,"abc",3);
for(i=0;i <5;i++)
printf(&q ......
6月5日消息,XX网站日前评出了10项大势已去的计算机技术。其中,有些技术已经被淘汰,有些即将被淘汰。如著名的Cobol语言,以及IBM的OS/2系统。
以下为XX网站评出的被淘汰的10项计算机技术:
......
辅助下单流程:
一、以某一交易品种g的当前成交价P为基础,上、下各拉开一定点数x双向挂单Tb(买单,挂单价格为Bp=P+x)和Ts(卖单,挂单价格为Sp=P- x),数量均为n。同时,仍以P为基础,设定Tb的止损点数Lb=P-y ......
大家好!我是一位C爱好者,向大家请教下,C程序员可好找工作?公司用C干些什么?
无所谓好不好找工作,一般通信、系统、嵌入式、硬件方面用的多,而且由于C的底层特性,学会后在学其他的会比较容易
不管用什么语 ......
'\108'作为字符常量对不对?
转义字符'\ddd'表示3位8进制所代表的字符。 但是108不是正确的8进制表示方法,因此应该是错误的。
但是char a='\108'; 为什么编译不出错呢?
\108 没超过 ......