编程论坛
注册
登录
编程论坛
→
C语言论坛
这个指针怎么用。。。?
gsmoking
发布于 2020-01-07 16:04, 2139 次点击
int (*(*func)[5][6])[7][8],知道了是一个指向二维数组的指针,每个元素又是指向二维数组的指针,具体怎么用??
6 回复
#2
rjsp
2020-01-07 16:26
什么叫“具体怎么用?”?
#3
八画小子
2020-01-07 17:06
目测具体应用中应该不会用到这个吧。
#4
叶纤
2020-01-07 17:08
回复 楼主 gsmoking
楼主写的指针是高级指针吧?我一丢丢都看不懂,正好我最近也在学习指针,
大家一起进步嘛,
#include<iostream>
using namespace std;
void a( double(*)[5],int length);//每一行设置成地址
int main() {
double c=0;
double b[3][5]= {
{1.1,2.1,3.1,4.1,5.1},
{6.1,7.1,8.1,9.1,10.1},
{1.2,2.2,3.2,4.2,5.2}
};
a(b,3);
}
void a( double(*arr)[5],int length)
{ for(int i=0;i<length;++i)
{ for(int j=0;j<5;++j)
{ cout <<arr[i][j]<<"\t";
}
cout << endl;
}
}
//我这个指针很小白,你要是想写更高级的我就没办法了,
#5
自学的数学
2020-01-07 20:30
typedef int (*PARR)[7][8];typedef PARR (*func)[5][6]; 很明白的,可知func是一个指向大小为5×6的二维数组的指针,其中,二维数组里的每个元素是一个二维数组。
#6
forever74
2020-01-07 21:58
楼主,在你第四节脊椎内侧坐标(x,y,z)处存在原生干细胞,我知道这玩意和一系列生物工程手段有关,这玩意具体怎么用?
楼主,你委托给东风快递的包裹我们都知道型号咧,这玩意具体怎么用?
......
看吧,不但历史总是相似的,生活中也处处有惊喜哟。
#7
forever74
2020-01-07 22:06
再复杂的指针也是指针,指针就是记录目标的地址的变量,就这么用。
#8
自由而无用
2021-08-11 13:26
#include <stdio.h>
#include <string.h>
typedef int *ptr;
typedef int *ar[10];
typedef int (*br)[10];
typedef int (*FLA)[10][10];
typedef FLA (*FLB)[10][10];
int main()
{
int a;
ptr p;
p = &a;
*p = a;
int b[10];
p = b;
*p = b[0];
int c[10][10];
p = c[0];
*p = c[0][0];
ar arr;
arr[0] = &a;
arr[1] = b;
arr[2] = c[0];
*arr[0] = a;
*arr[1] = b[0];
*arr[2] = c[0][0];
br brr;
brr = c;
FLA fla;
fla = &c;
FLB flb;
FLA flx[10][10];
flb = &flx;
puts("end of main");
return 0;
}
1