Keep Leading zeros C

你离开我真会死。 提交于 2019-12-02 03:37:07

You're reading these values into integers; integers don't have leading zeros.

If you know how many digits you want to pad out the length to, you can specify that in your format string:

printf("r0: %08lx, r1: %08lx\n", r0, r1);

There's no way to store and recall the exact number of leading zeroes without storing the value in a different format (e.g, a string), though.

Use the 0 flag (which specifies leading zeros), followed by the padded length.

printf("r0: %08lx, r1: %08lx\n", r0, r1);
             ^^         ^^

This link is a good reference to look at.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!