//
Main.c
Pointer_function
//
Created by Ma C on 15/8/2.
Copyright (c) 2015 BJSXT. All rights reserved.
Requirements: Through the pointer function, input student number, on the console display corresponding student scores.
#include <stdio.h>
Float *search (Float (*p) [4],int N)//float (*P) [4] is an array pointer to the first row of a two-bit array with 4 float elements
{
float *pt;
PT = * (p + N);
Return pt;
}
int main (int argc, const char * argv[])
{
Float score[][4]={{99,98,97,99},{88,97,96,96},{96,95,93,90}};
int Sno;
printf ("Please input sno are (0, 1, 2):");
scanf ("%d", &sno);
Float *p = search (Score,sno); //Call pointer function, return a pointer
for (int i=0;i<4;i++)
{
printf ("%.1f", * (P+i)); //Traverse the score of each row
}
printf ("\ n");
return 0;
}
C: Output the scores of each student in a two-dimensional array with pointer functions