首页 新闻 会员 周边 捐助

类型不兼容该怎样改呢?

0
悬赏园豆:10 [已解决问题] 解决于 2022-06-12 20:40

include <stdio.h>

float search(float (pointer)[4])
{
int i = 0;
float
pt;
pt = NULL;
for (i = 0; i < 4; i++)
{
if (
(pointer + i) < 60)
pt = pointer;
return(pt);
}
}
int main()
{
float
search(float
(pointer)[4]);
float score[][4] = { {60,70,80,90},{56,89,67,88},{34,78,90,66} };
float* p;
int i, j;
for (i = 0; i < 3; i++)
{
p = search(score + i);
if (p == *(score + i))
{
printf("No.%d score:", i);
for (j = 0; j < 4; j++)
{
printf("%5.2f ", *(p + j));

		}printf("\n");
	}
}
return 0;

}

上心&的主页 上心& | 初学一级 | 园豆:131
提问于:2022-06-12 16:02
< >
分享
最佳答案
0
#include <stdio.h>
float* search(float (pointer)[4])
{
int i = 0;
float* pt;
pt = NULL;
for (i = 0; i < 4; i++)
{
if (*(pointer + i) < 60)
pt = pointer;
return(pt);
}
}
int main()
{
float* search(float (pointer)[4]);
float score[][4] = { {60,70,80,90},{56,89,67,88},{34,78,90,66} };
float* p;
int i, j;
for (i = 0; i < 3; i++)
{
p = search(score + i);
if (p == *(score + i))
{
printf("No.%d score:", i);
for (j = 0; j < 4; j++)
{
printf("%5.2f ", *(p + j));

		}printf("\n");
	}
}
return 0;
}
收获园豆:10
Jijidawang | 初学一级 |园豆:154 | 2022-06-12 20:12

代码是这样没错,估计是我的编译器不行 vs2022版得 跑不了

上心& | 园豆:131 (初学一级) | 2022-06-12 20:41
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册