标题:int main()为什么没有返回值也行啊?
取消只看楼主
a47665335
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2014-11-25
结帖率:85.71%
已结贴  问题点数:20 回复次数:1 
int main()为什么没有返回值也行啊?
#include<stdio.h>
int main()
{
void hanoi(int n,char one,char two,char three);
int m;
printf("input the number of disks:");
scanf("%d",&m);
printf("The step to move %d disks:\n",m);
hanoi(m,'A','B','C');
//return 0;
}

void hanoi(int n,char one,char two,char three)
{
void move(char x,char y);
if (n==1)
move(one,three);
else
{
    hanoi(n-1,one,three,two);
    move(one,three);
    hanoi(n-1,two,one,three);
}
}

void move(char x,char y)
{
printf("%c->%c\n",x,y);
}


注不注释掉return都能运行,为什么啊?
求前辈解答!
搜索更多相关主题的帖子: include number return 
2014-12-30 11:09
a47665335
Rank: 1
等 级:新手上路
帖 子:20
专家分:0
注 册:2014-11-25
得分:0 
#include<stdio.h>
int main()
{

int m;
printf("input the number of disks:");
scanf("%d",&m);
printf("The step to move %d disks:\n",m);

//return 0;
}
只看这个也行..
2014-12-30 11:10



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-440522-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.021116 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved