0

Why we use int main( ) in some program s in place of void main?

Can any one help me to know this answer !

27th Oct 2019, 6:15 PM
Sunny Aitha
3 Antworten
+ 3
that's now the standard, from C11
27th Oct 2019, 6:22 PM
✳AsterisK✳
✳AsterisK✳ - avatar
+ 1
This is because the C++ standard requires main() to return int. As you probably know, the return value from the main() function is used by the runtime library as the exit code for the process. Both Unix and Win32 support the concept of a (small) integer returned from a process after it has finished. Returning a value from main() provides one way for the programmer to specify this value. If the code runs with no error then 0 is returned by the main()
28th Oct 2019, 8:16 AM
Arsenic
Arsenic - avatar