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 ......
编译普通的c没问题啊,但编译javah生成的就报错:
gcc -O0 -g3 -Wall -c -fmessage-length=0 -oHelloWorld.o ..\HelloWorld.c
gcc -otest.exe HelloWorld.o
d:/MinGW/bin/../lib/gcc/mingw32/3.4.5/../../. ......
问一下:
#include <stdio.h>
int main()
{
char x, y, z;
int i;
int a[16];
for(i=0; i<=16; i++)
{
a[i] = 0;
......
你们现在还在用C吗?C有前途吗?
一定,并永远坚持
引用
一定,并永远坚持
顶
有用。
楼主何出此言
楼主来c版问这个问题是踢馆用意吗哈哈
越来越冷是肯定的,完全淘汰倒也没那么容易
c ......
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( ......