void p1(int (*p)[2],int x,int y) {
int i = 0;
for ( i = 0; i < x; i++)
{
int j = 0;
for ( j = 0; j < y; j++)
{
printf("%d", *(*(p + i) + j));
printf("%d", (*(p + i))[j]);
printf("%d", p[i][j]);
}
printf("\n");
}
}
int main() {
int ret = check_s();
if (ret==1) {
printf("小段");
}
else
{
printf("大段");
}
int arr[] = { 123,123,123 };
int arr1[] = { 123,123,123 };
int arr2[] = { 123,123,123 };
int* arrset[] = { arr,arr1,arr2 };
int i = 0;
for ( i = 0; i < 3; i++)
{
int j = 0;
for ( j= 0; j < 3; j++)
{
printf("%d", *(arrset[i] + j));
}
printf("\n");
}
int arr4[3] = {1,2,3 };
int (*pa)[3] = &arr4;
int k = 0;
for (k = 0; k < 3;k++) {
printf("%d", (*pa)[k]);
printf("%d", *(*pa + k));
}
int arr5[3][2] = { {1,2}, {1.3},{2,2} };
int x = 3;
int y = 2;
//int(*p)[2] = &arr5;
p1(arr5,3,2);
return 0;
}
//int arr[5];
//int *arr[5]; 指针数组
//int (*p)[10] 数组指针
//int (*p[10])[ 5]
C语言指针进阶
最新推荐文章于 2024-08-30 21:44:53 发布