您的位置:首页 > 其它

用指针函数输出学生成绩

2015-11-30 20:58 387 查看
#include<stdio.h>

float *search(float(*p)[4],int n)
{
float *pt;
pt=*(p+n);
return (pt);
}

int main()
{
float score[][4]={{1,2,3,4},{2,3,4,5},{3,4,5,6},{4,5,6,7}};
float *p;
int k,i;
printf("enter the student's number you want to search:\n");
scanf("%d",&k);
printf("This student's scores are:\n");
p=search(score,k);
for(i=0;i<4;i++)
{
printf("%4.1f ",*(p+i));
}
printf("\n");
return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: