+ 5

Can you please tell me,the diffenrence between void main(),and int main().

Explain it.

17th Apr 2019, 9:01 AM
M Raghavendar
8 Respuestas
+ 7
Hi M Raghavendra There is a search function for the Q&A Discussions area which you many use to find many commonly asked questions. Here is one example I found. https://www.sololearn.com/Discuss/1492571/?ref=app There are many more, give the search function a try :)
17th Apr 2019, 9:14 AM
jay
jay - avatar
+ 5
//doesn't have a return statement //(void = nothing) void main(){ //some code } //returns an ineger //integer = number int main(){ //some code return 1; } //returns boolean //true/false bool main(){ //code return true; } Of corse, the number "1" could be an variable and be like return variablename; or something, but i hope you understood what i mean. int main() returns an int, bool main() returns a boolean and void main() returns nothing. If not, have a look at Datatypes😉🔥
17th Apr 2019, 11:50 PM
I‘m Sarah🌹
I‘m Sarah🌹 - avatar
+ 1
using return type will allow: If u want to use the output of a function later in the code or want to do more processing u can store it in a separate variable. By using same Kind of variable as the return statement will give you you int squAre(int a) { return a*a; } int c = squAre(3); OR you can directly print it: cout<<squAre(3) void: on the other side if you use void you will not be able to get the output of the code(mean you can get the result in a variable easily ... but to get this you can use reference an store the out put value in a variable
19th Apr 2019, 11:36 AM
Muhammad Kaleem Ullah
Muhammad Kaleem Ullah - avatar
+ 1
Void main() doesn't return any value but int main() will return integer value.Hope this will help you👍😊
21st Apr 2019, 12:11 PM
Marusha Khalid
Marusha Khalid - avatar
+ 1
Void main() means returns null value where int main() means function returns integer value
27th Apr 2019, 2:51 PM
SUJITH.K
SUJITH.K - avatar
0
Int main requires return type conformly but void main requires some times only and int main shows data type
25th Apr 2019, 5:40 AM
Anuradhapathipati
Anuradhapathipati - avatar
0
Void main does not require any return type. But int main need return type to be execute the code
31st May 2019, 5:19 AM
YASH PAL
YASH PAL - avatar
0
For Void main there is no return type
30th Jul 2019, 4:24 PM
seela lakshmikarthik