0

what's the difference between the int main() and void main() ? what is the best for use ?

22nd Aug 2016, 6:30 AM
Amel Alrooh
Amel Alrooh - avatar
3 Answers
+ 1
Void main doesn't return a value, int main takes a return value, like # return 0; Using an int return value is pretty useful in functions that you'd want to assign it's return value to an integer, like # int a = b(2)
22nd Aug 2016, 7:43 AM
Dogcatfee
Dogcatfee - avatar
+ 1
Here int and void are the return data types of the 2 functions . int main means that we are returning an integer value . void main means that we are returning a null value or simply nothing . As per their use , it depends on our needs and the type of value we want to return
22nd Aug 2016, 9:49 AM
Programmer
0
thank you #Dogcatfee
22nd Aug 2016, 8:13 AM
Amel Alrooh
Amel Alrooh - avatar