https://blog.csdn.net/lixd1210/article/details/104847089
int Func(int x); int (*p) (int x); p = Func;
|
方式1
int func(int a, int b) { cout << "func(int, int)" << a << b << endl; return 0; }
typedef int(MY_FUNC)(int, int);
MY_FUNC *fp = NULL; fp = func; fp(15, 20);
|
方式2:函数指针
typedef int (*MY_FUNC_P)(int, int);
MY_FUNC_P fp1 = NULL; fp1 = func; fp1(25, 30);
|
方式3
int (*fp3)(int, int) = NULL; fp3 = func; fp3(27, 89);
|
下列对函数指针声明描述正确的是 void fptr(int*); void *fptr(int*); void (*fptr)(int*); typedef void (*fptr)(int*); typedef void* (*fptr)(int*);
|
数组指针
int arr[] = { 99, 15, 100, 888, 252 }; int *p = arr;
int (*p)[n];
int (*a)[10] = &arr; int (&b)[10] = arr;
|
指针数组
*(p[i]+j) *(*(p+i)+j) (*(p+i))[j] p[i][j]
|
int p1[3]; int *p2[3]; int(*p3)[3];
int p4(int); int *p5(int); int (*p6)(int);
int (*p7)(int)[3];
int *(*p9(int))[3];
int *(*(*p10)(int))[3];
int(*p11(int))[3];
|