本文介绍了void main和int main之间的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 为什么我们使用int main()和Void main() 以及为什么我们在int main()中返回0 i我在讨论。 请详细告诉我。 解决方案 两者都可以接受。返回值 ExitCode ,当应用程序已经终止时返回给操作系统。退出代码约定是特定于应用程序的,不基于任何标准。通常,0被认为是没问题,其他值可用于指示在应用程序执行期间遇到的一些问题。父流程(例如,一些启动了相关应用程序的应用程序或一个称为 errorlevel 的批处理文件)可以在流程终止后检查退出代码并执行某些操作有这个值。 这些天,这个功能并不经常使用,因为它的性质和风格非常古老。我可以在一些非常不寻常的技术中使用,当产生一个单独的过程很重要时,但在几个过程中工作本身并不常见,因为在现代操作系统中流程很好地隔离。 请参阅: http://en.wikipedia.org/wiki/Exit_code [ ^ ]。 -SA why we use int main() and Void main()and why we return 0 in int main()i am in confussion.Please tell me about in detail. 解决方案 Both are acceptable. The return value it the ExitCode which is returned to the OS when application is already terminated. Exit code conventions are application-specific, not based on any standard. Usually, 0 is considered as "no problem", and other values can be used to indicate some problems encountered during application execution. A parent process (for example some your application which started the application in question or a batch file where it is called errorlevel) can examine exit code after the process is terminated and do something with this value.These days, this feature is not used often, because it is pretty archaic in its nature and style. I can be used in some pretty unusual techniques, when spawning a separate process is important, but working in several processes is itself not very usual, because processes are well isolated in modern OS.Please see: http://en.wikipedia.org/wiki/Exit_code[^].—SA 这篇关于void main和int main之间的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云! 07-22 21:36