在C:main()和INT的主要区别() [英] In C: Difference between main() and int main ()

查看:126
本文介绍了在C:main()和INT的主要区别()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  

可能重复:结果
  <一href=\"http://stackoverflow.com/questions/3711048/difference-between-mainvoid-and-main-in-c\">difference在主(无效)和main()的C之间


我知道这是超级基本和一些其他线程已经谈过类似的问题。但是,我有一本书(绝对初学者指南C),所有的code是函数main内写()。 int是永远离开了。这怎么可能跑?这样行可能与旧版本的文件stdio.h的?结果
下面是示例code:

 的#include&LT;&stdio.h中GT;主()//不是int main()的
{
的printf(这是它\\ n);
返回0;
}


解决方案

我觉得C8​​9标准将允许 的main(),但C99及以上不会。你必须使用 INT的main(),否则。

Possible Duplicate:
difference between main(void) and main() in c

I know this is super basic and some other threads already talked about similar questions. But I have a book (Absolute Beginners Guide to C) where all the code is written within the function main(). The int is always left out. How is that possible to run? Is that ok with maybe an older version of stdio.h?
Here is the sample code:

#include <stdio.h>

main()  // not int main()
{
printf("This is it\n");
return 0;
}

解决方案

I think the c89 standard will allow main() but c99 and above won't . You have to use int main() otherwise .

这篇关于在C:main()和INT的主要区别()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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