How to print variable addresses in C?

前端 未结 5 1293
孤独总比滥情好
孤独总比滥情好 2020-11-29 23:32

When i run this code.

#include 

void moo(int a, int *b);

int main()
{
    int x;
    int *y;

    x = 1;
    y = &x;

    printf(\"Addr         


        
5条回答
  •  醉话见心
    2020-11-30 00:10

    I tried in online compiler https://www.onlinegdb.com/online_c++_compiler

    int main()
    {
        cout<<"Hello World";
        int x = 10;
        int *p = &x;
        printf("\nAddress of x is %p\n", &x); // 0x7ffc7df0ea54
        printf("Address of p is %p\n", p);    // 0x7ffc7df0ea54
    
        return 0;
    }
    

提交回复
热议问题