Translate

ads

1 Aug 2019

Is it fine to jot down “void main()” or “main()” in C/C++?

Is it fine to jot down “void main()” or “main()” in C/C++?


c



Is it fine to jot down “void main()” or “main()” in C/C++?

wordpress



is not and ne'er has been C++, nor has it even been C. See the ISO C++ commonplace 3.6.1[2] or the ISO C commonplace 5.1.2.2.1. A conforming implementation accepts




html


and


css



A conforming implementation might give a lot of versions of main(), however they have to all have come back type int. The int returned by main() could be a method for a program to come back a value to “the system” that invokes it. On systems that doesn’t give such a facility the come back value is neglected, however that doesn’t build “void main()” legal C++ or legal C. even if your compiler accepts “void main()” avoid it, or risk being thought-about ignorant by C and C++ programmers.
In C++, main() needn't contain a certain come back statement. in this case, the value came back is 0, which means productive execution.


example:


javascript

Note also that neither ISO C++ nor C99 permits you to go away the kind out of a declaration. That is, in distinction to C89 and ARM C++ ,”int” isn't assumed wherever a type is missing in an exceedingly declaration. Consequently


book


No comments:

Post a Comment