0

C

What is the difference between int main() & void main()? Why we are using return 0 only for int main() not for void main()

31st Jul 2019, 1:28 PM
Yadlapalli Karishma
2 ответов
+ 2
When you are using int main(), it acts like a function so it has to return an integer. You can return any whole numberwhen using int main(). void main() is supposed to return nothing as void functions are used to return nothing.
31st Jul 2019, 1:42 PM
Pikachu
Pikachu - avatar
0
void main() is when return type is void. int main() has got a return type. So basically, In ->void main()we don't have return type. ->int main() we use a return which is of int type for the function main() so we use return 0.
11th Jun 2022, 8:09 PM
Ranit Ghosh
Ranit Ghosh - avatar