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())
相关问答:
以前在VC里面建一个工程,都只用一个 .c 文件,昨天在一个工程里用了两个 .c文件了,遇到问题了,请大家指点。比如:
File1.c Fil ......
C\C++如何计算函数的导数,本人新手,想写个程序,但是不知道如何下手,还望高手指点一二,谢过。
这个……
跟函数的具体形式有关吧,难道你想编出个“万能”的求导函数?
俺上学时想过自动推导公式,后来 ......
6月5日消息,XX网站日前评出了10项大势已去的计算机技术。其中,有些技术已经被淘汰,有些即将被淘汰。如著名的Cobol语言,以及IBM的OS/2系统。
以下为XX网站评出的被淘汰的10项计算机技术:
......
C/C++ code:
#include<stdio.h>
void main()
{
unsigned int v,u;
char c1,c2;
scanf("%o,%o",&u,&v);
scanf("%c,%c",&c1,&c2);
printf( ......
大家好!我是一位C爱好者,向大家请教下,C程序员可好找工作?公司用C干些什么?
无所谓好不好找工作,一般通信、系统、嵌入式、硬件方面用的多,而且由于C的底层特性,学会后在学其他的会比较容易
不管用什么语 ......