#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
int main() {
int* p1 = NULL;
char* pc = NULL;
int arr[10] = { 1,2,3,4,5,6,7,8,9,10 };
int(*pa)[10] = &arr;
int i = 0;
for (i = 0; i < 10; i++) {
printf("%d ", (*pa)[i]);
}
printf("\n-----------\n");
for (i = 0; i < 10; i++) {
printf("%d ", *(*pa + i));
}
printf("\n-----------\n");
int* pb = arr;
int j = 0;
for (j = 0; j < 10; j++) {
printf("%d ", *(pb + j));
}
return 0;
}
1 2 3 4 5 6 7 8 9 10
-----------
1 2 3 4 5 6 7 8 9 10
-----------
1 2 3 4 5 6 7 8 9 10
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
void Print1(int arr[3][5], int x, int y) {
int i = 0;
int j = 0;
for (i = 0; i < x; i++) {
for (j = 0; j < y; j++) {
printf("%d ", arr[i][j]);
}
printf("\n");
}
}
void Print2(int(*p)[5], 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("\n");
}
}
int main() {
int arr[3][5] = { {1,2,3,4,5},{2,3,4,5,6},{3,4,5,6,7} };
Print1(arr, 3, 5);
printf("-----------\n");
Print2(arr, 3, 5);
return 0;
}
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7
-----------
1 2 3 4 5
2 3 4 5 6
3 4 5 6 7