#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 指向的内存块的地址。