如何打印一个unsigned long int类型在C的printf? [英] How to print an unsigned long int with printf in C?

查看:6582
本文介绍了如何打印一个unsigned long int类型在C的printf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

可能重复:结果
  如何给printf“无符号长”的用C?

我有我的电话号码是这样的...

I have my number like so...

int unsigned long number = 600851475143;

我试图用打印的printf()。每次我尝试,我由编译器产生警告。

I am trying to print it with printf(). Every time I try, I get a warning by the compiler.

我试过%ULD %LD 和谷歌搜索似乎并没有找到我的答案。

I've tried %uld, %ld and Googling hasn't seemed to find me the answer.

我学习C,但还没有收到使用长整型,所以我不知道我应该使用。

I'm learning C, but have not had to use a long int before, so I'm not sure what I should be using.

什么是我追逐的说明?

推荐答案

我建议使用标准顺序(即unsigned long int类型)。 鲁%是您正在寻找的格式标记。

I recommend using standard order (i.e. unsigned long int). %lu is the format tag you're looking for.

printf("%lu", 5ul);

这篇关于如何打印一个unsigned long int类型在C的printf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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