递归主要 [英] recursive main

查看:86
本文介绍了递归主要的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我在静态变量中有另一个问题。请参阅以下代码

为什么它打印所有0而不是4 3 2 1?

1)

void main()

{

static int i = 5;

if( - i){

main();

printf("%d",i);

}

}

答案:

0 0 0 0

解决方案

ra sction:la scritto:

你好,
我在静态变量中有另一个问题。请参阅以下代码
为什么它打印所有0而不是4 3 2 1?
1)
void main()
{
static int i = 5;
if( - i){
main();
printf("%d",i);




你必须再次打电话给主打印。


-

Devaraja(Xdevaraja87 ^ gmail ^ c0mX)

Linux注册用户#338167
http://counter.li.org


ra*******@gmail.com 写道:

你好,
我在静态变量中有另一个问题。看下面的代码
为什么它打印所有0而不是4 3 2 1?
1)
void main()



^^^

怎样才能有人发布三个问题所有相同的

基本错误?


Martin Ambuhl写道:< blockquote class =post_quotes> ra*******@gmail.com 写道:

你好,
我在静态变量中有另一个问题。看下面的代码
为什么它打印所有0而不是4 3 2 1?
1)
void main()
^^^
任何人都有胆量发布三个问题都有相同的基本错误?




至少他是一致的..........
< br $>
亲切的问候,

Johan


-

ooooooo。 。 。 _____J_o_h_a_n___B_o_r_k_h_u_i_s___

o _____ || http://www.borkhuis.com |

。] [__n_n_ | DD [==== _____ | jo***@borkhuis.com |(________ | __ | _ [_________] _ | ________________________________ |


_ / oo OOOOO oo` ooo ooo''o!o!oo!o!o`

== VxWorks FAQ: http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html ==

hello,
I have another problem in static variables. See following code
why it prints all 0 instead 4 3 2 1 ?
1)
void main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);
}
}
Answer:
0 0 0 0

解决方案

ra*******@gmail.com ha scritto:

hello,
I have another problem in static variables. See following code
why it prints all 0 instead 4 3 2 1 ?
1)
void main()
{
static int i=5;
if(--i){
main();
printf("%d ",i);



You must print before calling main again.

--
Devaraja (Xdevaraja87^gmail^c0mX)
Linux Registerd User #338167
http://counter.li.org


ra*******@gmail.com wrote:

hello,
I have another problem in static variables. See following code
why it prints all 0 instead 4 3 2 1 ?
1)
void main()


^^^
How can anyone have the gall to post three questions all with the same
basic error?


Martin Ambuhl wrote:

ra*******@gmail.com wrote:

hello,
I have another problem in static variables. See following code
why it prints all 0 instead 4 3 2 1 ?
1)
void main()
^^^
How can anyone have the gall to post three questions all with the same
basic error?



At least he is consistent..........

Kind regards,
Johan

--
o o o o o o o . . . _____J_o_h_a_n___B_o_r_k_h_u_i_s___
o _____ || http://www.borkhuis.com |
.][__n_n_|DD[ ====_____ | jo***@borkhuis.com |(________|__|_[_________]_|________________________________|


_/oo OOOOO oo` ooo ooo ''o!o!o o!o!o`
== VxWorks FAQ: http://www.xs4all.nl/~borkhuis/vxworks/vxworks.html ==


这篇关于递归主要的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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