我如何在C中获得这些输出? [英] How am I getting these outputs in C?
本文介绍了我如何在C中获得这些输出?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
main() {
double=1/2.0-1/2;
printf("d=%.21f",d);
}
Output: 0.50000000000000
不应该是0?
shouldn't it be 0?
main() {
int a=5;
a=printf("Good")
printf("%d",a);
}
Output:Good4
为什么会这样?
How come this?
main() {
printf("\nab");
printf("\bsi");
printf("rha");
}
Output:hai
如何?
How?
推荐答案
你应该做一些关于C的基本知识,特别是在 printf的。这不是一个简单的交易,需要一些实践。
提示:blackslash是一个控制角色,会导致特殊行为。比如\ n意味着新线就像击中Enter一样。
请阅读几个小时并玩弄那些东西。 ; - )
You should do some basic learning about C and especially the use of formatters in printf. It isnt a easy deal and needs some pratice.
Tip: The blackslash is a control character and leads to special behaviour. like "\n" means "new line" like hitting Enter.
Please read some hours and play around with that stuff. ;-)
第一个问题。查找运算符优先级。
For your first problem. Look up operator precedence.
这篇关于我如何在C中获得这些输出?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文