问题描述
声明
printf("%d%d);
将打印第一个第二个初始化变量(如果存在) )
怎么可能
the statement
printf("%d %d");
will print the 1st 2nd initialized variables(if present)
how is tht possible
推荐答案
是什么让你如此想的?仅仅因为你的实现没有barf
破坏代码并不意味着它产生的随机事物是正确的。
What makes you think so? Just because your implementation doesn''t barf
at broken code doesn''t mean whatever random thing it produces is right.
两者都没有''tht''以任何方式得到保证。学习写法律
C;它会比你玩破坏的代码更有帮助。
Neither that not ''tht'' are in any way guaranteed. Learn to write legal
C; it will help you much more than your playing with broken code.
不,它不会。
它会打印无论发生什么垃圾都是由printf在
上发现的,它预计有两个整数。你的实现可能会花点b $ b恰好在那里保留两个先前初始化的变量。
我有适当的垃圾。
有些人也会争辩它不一定会打印出来的东西,因为你没有告诉你在任何地方打印出一个终止换行符。 ;)
未定义真正发生的事情,因为你应该提供
两个整数。
-
我的电子邮件地址是真的,我看了。
No, it won''t.
It will print whatever rubbish happens to be found by printf on
the stack where it expects two ints. Your implementation may
just happen to keep two previously initialised variables there.
Mine has proper rubbish.
Some would also argue it won''t necessarily print a thing, as you
don''t show you printed a terminating newline anywhere. ;)
It''s undefined what happens really, as you should have supplied
two ints.
--
My e-mail address is real, and I read it.
不,它不会。
它将打印printf上发现的垃圾。
预期两个整数的堆栈。你的实现可能只需要保留两个先前初始化的变量。
我有适当的垃圾。
No, it won''t.
It will print whatever rubbish happens to be found by printf on
the stack where it expects two ints. Your implementation may
just happen to keep two previously initialised variables there.
Mine has proper rubbish.
什么堆栈?它有不确定的行为。
-
[邮件]:Chuck F(cinefalconer at maineline dot net)
[page ]:< http://cbfalconer.home.att.net>
尝试下载部分。
-
通过上的免费Usenet帐户发布
What stack? It has undefined behaviour.
--
[mail]: Chuck F (cbfalconer at maineline dot net)
[page]: <http://cbfalconer.home.att.net>
Try the download section.
--
Posted via a free Usenet account from http://www.teranews.com
这篇关于printf()的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!