其他分享
首页 > 其他分享> > 关于*和&的数组操作运算对比(二维数组)

关于*和&的数组操作运算对比(二维数组)

作者:互联网

code

 1 #include <stdio.h>
 2 int main(void)
 3 {
 4     int a[3][4]={  5, 10, 15, 20, 
 5                   25, 30, 35, 40, 
 6                   45, 50, 55, 60};
 7 
 8     printf("       a=%08x\n",  a);
 9     printf("     a+1=%08x\n\n",  a+1);
10 
11     printf("      *a=%08x\n", *a);
12     printf("    *a+1=%08x\n\n", *a+1);
13 
14     printf("     **a=%08x\n",**a);
15     printf("   **a+1=%08x\n\n", **a+1);
16 
17     printf("      &a=%08x\n", &a);
18     printf("    &a+1=%08x\n\n\n\n\n\n", &a+1);
19 
20     printf("    %08x    ",&a[0][0]);
21     printf("%08x    ",&a[0][1]);
22     printf("%08x    ",&a[0][2]);
23     printf("%08x\n\n",&a[0][3]);
24 
25     printf("    %08x    ",&a[1][0]);
26     printf("%08x    ",&a[1][1]);
27     printf("%08x    ",&a[1][2]);
28     printf("%08x\n\n",&a[1][3]);
29 
30     printf("    %08x    ",&a[2][0]);
31     printf("%08x    ",&a[2][1]);
32     printf("%08x    ",&a[2][2]);
33     printf("%08x\n\n",&a[2][3]);
34 
35     getchar();
36     return 0;
37 } 

运行结果

标签:25,08x,20,运算,10,int,二维,数组,printf
来源: https://www.cnblogs.com/kunshanpipixia/p/14608972.html