| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 545 人关注过本帖
标题: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
快速回复:int main()为什么没有返回值也行啊?
数据加载中...
 
   



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

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