标题:[求助]dev c++ 编译报错
只看楼主
bond111
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2006-11-11
 问题点数:0 回复次数:2 
[求助]dev c++ 编译报错
小弟在学习时改了书上一个程序,可编译报错,还望各位指教,谢谢!!
下面是程序和出错信息
#include <stdio.h>
main()
{
float score[][4]={{60,70,80,90},{56,89,69,88},{34,78,90,66}};
float *search(float (*pointer)[4],int m);
int n,i;
printf("enter the student's number\n" );
scanf("%d",n);
float *search(float (*pointer)[4],int m)
{
return(*(*pointer+m));
}
for(i=0,i<=4,i++)
printf("%f",*search(score,n);
}
红字是出错地方 ,dev c++ 报错 "a function-definition is not allowed here before '{' token "
搜索更多相关主题的帖子: dev 编译 float 
2006-11-11 22:09
lj_860603
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:714
专家分:0
注 册:2006-1-25
得分:0 
Why you put the search funtion inside the main funtion?

The search funtion must be outside the main funtion.Try to move the search funtion outside the main funtion.

There is another problem in your routine.That is "scanf("%d",n);".You have to add a '&' before the 'n'.

我的原则很简单:不做不喜欢的事!
2006-11-11 23:29
bond111
Rank: 1
等 级:新手上路
帖 子:23
专家分:0
注 册:2006-11-11
得分:0 

谢谢!

2006-11-12 15:24



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




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

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