织梦CMS - 轻松建站从此开始!

abg欧博官网|登陆|游戏|

What is the difference between %lx and %ld when p

时间:2025-07-24 23:11来源: 作者:admin 点击: 0 次
I have tried googling the first one for %lx, but I have no good results, BUT I have successfully searched up %ld which is just long int. Necessary for

I have tried googling the first one for %lx, but I have no good results, BUT I have successfully searched up %ld which is just long int. Necessary for printing addresses I guess, but what is %lx for?

This is where I am confused:

int main() { int value = 25; int *pointer = &value; printf("%ld\n", pointer); // prints out the address of variable value( I hope) printf("0x%lx\n", pointer); // Completely confused here, is this perhaps address in hex? }

Would be awesome if someone can clear this confusion I am having!

I have ran this code, and I have the results, but I am still not sure what the lx does..I have seriously tried googling this "%lx" in google, but no results explaining it.

Edit: if I use 'p' to print address then have I been wrong in thinking %ld prints address? Confused.

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2025-07-27 07:07 最后登录:2025-07-27 07:07
栏目列表
推荐内容