0

Why we cannot use voide at place of int in c++language

13th Jan 2018, 5:12 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
11 ответов
+ 10
The return value of main() is the exit code of the program.  This is universally 0 for a "normal" exit and non-zero for abnormal.  An int was chosen as the simplest data type with broad cross language compatibility.
13th Jan 2018, 5:35 PM
🌛DT🌜
🌛DT🌜 - avatar
+ 2
If you are looking at old books or old code examples and it shows void main its out of date. Microsofts Visual C++ compiler used to allow it but it has never been a part of C++ to allow the use of void main and will not work on any newer compiler.
13th Jan 2018, 6:02 PM
emmey
emmey - avatar
+ 1
you can write void functions in c++
13th Jan 2018, 5:16 PM
emmey
emmey - avatar
0
ok
13th Jan 2018, 5:26 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
but it shows error
13th Jan 2018, 5:27 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
ok
13th Jan 2018, 5:30 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
thanx
13th Jan 2018, 5:36 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
i get it
13th Jan 2018, 5:36 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
oh means we use void only in function
13th Jan 2018, 5:37 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
ok
13th Jan 2018, 5:37 PM
ratnaprabha purandare
ratnaprabha purandare - avatar
0
ok
13th Jan 2018, 6:17 PM
ratnaprabha purandare
ratnaprabha purandare - avatar