为什么取名为主要函数main() [英] Why the name main for function main()

查看:136
本文介绍了为什么取名为主要函数main()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么函数名的main()保留在像C,C ++,Java的许多语言?为什么不为任何功能的其他名字呢?是否有任何共同的结构所有这些3个主要()(在C,C ++,Java的)

Why the function name main() is retained in many languages like C, C++, Java? Why not any other names for that function? Is there any common structure for all these 3 main() (in C, C++, Java)

推荐答案

有很多愚蠢的,而不是非常恭敬的回答这里一个合理的问题。

There are a lot of silly and not very respectful answers here to a legitimate question.

ç不是来自无处。它的直接祖先是B,由Ken Thompson写的。下面是对 B手工的链接。 A B程序的基本结构是

C didn't come from nowhere. Its immediate ancestor is B, written by Ken Thompson. Here is a link to the B manual. The basic structure of a B program is

的main();出口();

main(); exit();

的main()是由程序员和退出()是由库提供的提供。这似乎是主要的首次亮相()为B,BCPL的predecessor,有没有这样的概念。我猜你会问肯·汤普逊为什么它是主要的,而不是别的东西。

main() is provided by the programmer and exit() is supplied by the library. This seems to be the first appearance of main() as the predecessor of B, BCPL, has no such concept. I guess you would have to ask Ken Thompson why it was main and not something else.

这篇关于为什么取名为主要函数main()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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