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()
2 odpowiedzi
+ 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.
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.