请高手指教一下

goodboy5201314 2009-09-12 09:14:47
#include<stdio.h>

main()
{
static float score[][4]={{78, 89, 67, 78}, {98, 76, 87, 90}, {66, 88, 98, 86}};
float *search();
float *p;
int i, m;
printf("Please input the numbers of student:\n");
scanf("%d", &m);
printf("The scores of No.%d are :\n", m);
p = search(score, m);
for(i=0; i<4; i++)
printf("%5.2f\t", *(p+i));
}

float *search(pointer, n) //这里为什么不能这样:先定义全局变量int n;和float (*pointer)呢??
int n;
float (*pointer)[4];
{
float *pt;
pt = *(pointer+n-1);
return(pt);
}
...全文
69 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
goodboy5201314 2009-09-22
  • 打赏
  • 举报
回复
呀,原来自己在看古董书呀
x2x2x2 2009-09-12
  • 打赏
  • 举报
回复
长知识啊
cphj 2009-09-12
  • 打赏
  • 举报
回复
float *search(pointer, n)
int n;
float (*pointer)[4];
{

这是C--的语法
xiaocai0001 2009-09-12
  • 打赏
  • 举报
回复
楼主的函数申明写的是哪年的标准?

该不会是看谭浩强C语言程序设计第一版吧?
Jeffrey.zhu 2009-09-12
  • 打赏
  • 举报
回复
Maybe,词法分析问题,从左到右
mstlq 2009-09-12
  • 打赏
  • 举报
回复
float *search(pointer, n) //这里为什么不能这样:先定义全局变量int n;和float (*pointer)呢??
int n;
float (*pointer)[4];

相当于
float *search(float (*pointer)[4], int n)
相当古老的写法了……
brookmill 2009-09-12
  • 打赏
  • 举报
回复
float *search(pointer, n)
int n;
float (*pointer)[4];
{

这是20年前的函数参数写法。
这里的n和pointer不是全局变量,而是相当于
float *search(float (*pointer)[4], int n)
{

69,336

社区成员

发帖
与我相关
我的任务
社区描述
C语言相关问题讨论
社区管理员
  • C语言
  • 花神庙码农
  • 架构师李肯
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧