请问 下面的程序是什么问题?
#include<stdio.h>
#define nmax 50;
int main(void)
{
int i,k,m,n;
int num[nmax], p;
printf("please put on the number:");
scanf("%d",&n);
p=num;
for(i=0;i<n;i++)
*(p+1)=i+1;
i=0;
k=0;
m=0;
while(m<n-1)
{
if(*(p+i)!=0) k++;
if(k==3){
*(p+i)=0;
k=0;
m++;
}
i++;
if(i==n) i=0;
}
while(*p==0)p++;
printf("%d %d\n",n,*p);
}
编译出现这样的问题
p 未声明
具体的错误看我的发的附件
c 编译 出现段错误???
-
- 帖子: 9
- 注册时间: 2008-09-11 1:20
-
- 帖子: 2841
- 注册时间: 2006-09-11 22:47
Re: c 编译 出现段错误???
#define nmax 50;
就这一行的问题,自己查查C语法。
就这一行的问题,自己查查C语法。
- liupingjing
- 帖子: 451
- 注册时间: 2007-11-29 17:31
Re: c 编译 出现段错误???
宏定义后不能有分号吧!