指针数组(主要用于二维的数组)

来源:互联网 发布:小意思tpo for mac 编辑:程序博客网 时间:2024/04/30 16:00
#include<iostream>using namespace std;float* search(float(*p)[4], int n){float*pt;pt = *(p + n);//取得是第n行的首地址return pt;}int main(){float score[][4] = { { 49, 34, 46, 23 }, { 42, 36, 25, 125 }, { 35, 53, 67, 7 }, { 378, 80, 97, 79 } };float*p;int i, j;cout << "输入查询第几个学生" << endl;cin >> j;p = search(score, j);for (i = 0; i < 4; i++)cout << *(p + i) << endl;system("paues");return 0;}

0 0
原创粉丝点击