为什么变量的printf输出不同 [英] Why printf output of the variable is different

查看:39
本文介绍了为什么变量的printf输出不同的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不知道为什么会这样!想知道原因.

I could not know why it happen! Want to know the reason.

{
int i=01;
printf("%d\n",i);
}
output: 1

但是

{
int i=011;
printf("%d\n",i);
}
output: 9

有人知道答案吗?

推荐答案

011 = Octal, (1*8)+1=9 .......................

011 = Octal, (1*8)+1=9 ........................

这篇关于为什么变量的printf输出不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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