标题:请高手帮忙,程序错哪里了?用GCC编译器
取消只看楼主
flybird40000
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-12-6
结帖率:0
已结贴  问题点数:20 回复次数:2 
请高手帮忙,程序错哪里了?用GCC编译器
#include <stdio.h>
#include <string.h>
#define N 2
void input_e(num,name)
int num[];
char name[N][8];
{
int i;
for(i=0;i<N;i++)
{
printf("\n输入职工号: ");
scanf("%d", &num[i]);
printf("\n 输入职工名: ");
getchar();
gets(name[i]);
}


}


main()
{
int num[N];
char name[N][8];
input_e(num,name);

}


4: error: variable or field `input_e' declared void
4: error: `num' was not declared in this scope
4: error: `name' was not declared in this scope
5: error: initializer expression list treated as compound expression
5: error: expected `,' or `;' before "int"
7: error: expected unqualified-id before '{' token
7: error: expected `,' or `;' before '{' token
In function `int main()':
24: error: `input_e' cannot be used as a function
搜索更多相关主题的帖子: GCC num name int expected 
2017-12-19 16:12
flybird40000
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-12-6
得分:0 
用vc6.0运行可以通过,但是用gcc编译器3.4.0版本,运行出现如下错误

4: error: variable or field `input_e' declared void
4: error: `num' was not declared in this scope
4: error: `name' was not declared in this scope
5: error: initializer expression list treated as compound expression
5: error: expected `,' or `;' before "int"
7: error: expected unqualified-id before '{' token
7: error: expected `,' or `;' before '{' token
In function `int main()':
24: error: `input_e' cannot be used as a function
2017-12-19 16:16
flybird40000
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2012-12-6
得分:0 
弱弱的问一下,为什么这么改写?原理是什么?
2017-12-19 18:11



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-483511-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.068540 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved