[求助]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 "
----------------解决方案--------------------------------------------------------
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'.
----------------解决方案--------------------------------------------------------
谢谢!
----------------解决方案--------------------------------------------------------