小编lim*_*mbo的帖子

如何获取指针所指向的内存位置的地址

 #include <stdio.h>

    int main(void)
    {
        int i = 3;
        int* j = &i;
        printf("%u",j);
    }
Run Code Online (Sandbox Code Playgroud)

上面的代码应该打印出包含整数3的内存块的地址(一个无符号整数)。但我却收到了这个错误 error: format specifies type 'unsigned int' but the argument has type 'int *'- 。

我从各种来源确认:
1.*j指“存储在 j 中的地址处的值”
2.&j指存储指针 j 的内存块的地址。
3. j 包含一个 unsigned int 值,它是 j 指向的内存块的地址。

c pointers

1
推荐指数
1
解决办法
4118
查看次数

标签 统计

c ×1

pointers ×1