1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#include <stdio.h>
int main()
{
float arr2d[2][4] = { { 1.0f, 2.0f, 3.0f, 4.0f }, { 5.0f, 6.0f, 7.0f, 8.0f } };
printf("%lld\n", (long long)arr2d); // Use unsigned long long in x64
printf("%lld\n", (long long)arr2d[0]);
printf("\n");
// arr2d points to arr2d[0] (not arr2d[0][0])
printf("%lld\n", (long long)* arr2d);
printf("%lld\n", (long long)& arr2d[0]);
printf("%lld\n", (long long)& arr2d[0][0]);
printf("%f %f\n", arr2d[0][0], **arr2d);
printf("\n");
printf("%lld\n", (long long)(arr2d + 1));
printf("%lld\n", (long long)(&arr2d[1]));
printf("%lld\n", (long long)(arr2d[1]));
printf("%lld\n", (long long)(*(arr2d + 1)));
printf("%lld\n", (long long)(&arr2d[0] + 1));
printf("%lld\n", (long long)(&arr2d[1][0]));
printf("\n");
printf("%f\n", *(*(arr2d + 1) + 2));
printf("\n");
for(int j = 0 ; j < 2 ; ++j)
{
printf("[%d] = %lld, %lld\n", j, (long long)(arr2d[j]), (long long) * (arr2d + j));
for(int i = 0 ; i < 4 ; ++i)
{
printf("[%d][%d] = %f, %f\n", j, i, arr2d[j][i], *(*(arr2d + j) + i));
*(*(arr2d + j) + i) += 1.0f; // arr2d[j][i] += 1.0f;
}
}
printf("\n");
}
Enter to Rename, Shift+Enter to Preview