Why we use int main( ) in some program s in place of void main? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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
2 Respostas
+ 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