什么是UL%和%鲁C画幅符之间的区别? [英] What's the difference between %ul and %lu C format specifiers?

查看:268
本文介绍了什么是UL%和%鲁C画幅符之间的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在的C的Primer Plus为例,笔者使用了%UL 格式说明(在scanf函数和printf)对于无符号长。当我尝试概括的问题,似乎%UL 使得一些错误在我的电脑。但是,使用鲁%解决了问题。

In an example of "C Primer Plus", the author has used %ul format specifier (in both scanf and printf) for unsigned long. When I try to generalize the problem, it seems that the %ul makes something wrong in my computer. But using %lu solved the issue.

其实,而非着眼于问题的codeS行了,我想知道的%UL 的区别鲁%。也许我可以找出什么是错的。

Actually, rather than focusing on the problem and the line of codes, I want to know about the difference between %ul and %lu. Maybe I could figure out what's wrong.

搜索不给我一些有用的东西(除了它们是不同的)。

Searching doesn't give me something useful (except that "they are different").

任何解释或链接/参考AP preciated。

Any explanation or link/reference is appreciated.

推荐答案

%禄是正确的,而%UL 是的不正确

一个 的printf 格式说明如下形式%[国旗] [宽度] [precision] [长度]说明

U 说明的意思是无符号的十进制整数。

u is a specifier meaning "unsigned decimal integer".

长度的修改意为长。

长度的修改应在转换前的说明的,这意味着%禄走的是正确的。

The length modifier should go before the conversion specifier, which means %lu is correct.

这篇关于什么是UL%和%鲁C画幅符之间的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆