c++ 原始指针指针

指针

struct C
{
    int x, y;
} c;
 
int* px = &c.x;
int* pxe= px + 1;
int* py = &c.y;

int main() {
    printf("value of c.x: = %d\n", c.x);
    printf("value of c.y: = %d\n", c.y);
    printf("address of c.x: = %p\n", (void*)&c.x);
    printf("address of c.y: = %p\n", (void*)&c.y);
    printf("sizeof int: = %d\n", sizeof(int));
    return 0;
}

运行结果:

posted @ 2025-03-17 17:33  又玄  阅读(7)  评论(0)    收藏  举报