C 语言 右左法则 (1)

来源:互联网 发布:怎么做数据分析报告 编辑:程序博客网 时间:2024/06/03 23:44
#include <stdio.h>#include <tchar.h>int _tmain(int argc, _TCHAR* argv[]){    //int a[2][2] = { 1, 2 , 3, 4 };    int a[2][2] = { { 1, 2 },{ 3, 4 } };    int *p1 = &(a[0][0]); //  取首地址!    printf("%ld %ld \n", p1, (*p1)); // 1    p1++;    printf("%ld %ld \n", p1, (*p1)); // 3    p1++;    printf("%ld %ld \n", p1, (*p1)); // 4    p1++;    printf("%ld %ld \n", p1, (*p1)); // 5    int(*px)[2] = a;     // px 其实就是个二维数组而已      //px指向的是一个一维数组 ++之后指向另一个二维数组    printf("%ld %ld \n", (*px)[0], (*px)[1]); // 1 2    px++;    printf("%ld %ld \n", (*px)[0], (*px)[1]);  //  3 4    int(*p)[10] = {}; // 4    int *q[10];  // 40    printf("%ld %ld",sizeof(p),sizeof(q));    getchar();    return 0;}

输出入:

15727736 1
15727740 2
15727744 3
15727748 4
1 2
3 4
4 40

原创粉丝点击