同一个.c文件中
ulong functest()
{
ulong temp = 0x1234567891;
printf("\r\n functest temp = [%p]\r\n",temp);
return temp;
}
void fun()
{
ulong test;
test = functest();
printf("\r\n test = [%p] \r\n",test);
}
结果 functest temp = [0x1234567891]
test = [0x34567891]
ulong 的定义是 unsigned long 吗??
unsigned long 的范围只有这么大。。。2的32次方
%p
代表指针类型,你的代码哪里有指针了?
不同编译器对地址的处理不一样,直接用一个数值代表指针值结果不确定啊。
应该用%x
参数打印。