+ 3

Explain the diffrence between int main and void main please.

8th Sep 2018, 1:03 PM
Saurabh Pisal
Saurabh Pisal - avatar
4 Réponses
+ 12
int main returns a value void main does not return value
8th Sep 2018, 1:36 PM
Naola
Naola - avatar
+ 8
int main return an int value. void main not return anything. In almost compiler now, main must return int. When you declared main as void, it is error! Some old compiler like Turbo C++, main return as void!
8th Sep 2018, 1:49 PM
LetterC67
LetterC67 - avatar
+ 5
int main() usually has to return 0 at the end (can be omitted in modern compilers), while void main() doesn't have to return anything. int main() is the standard however.
8th Sep 2018, 1:36 PM
hinanawi
hinanawi - avatar