what is the situation to use void? can we replace void with int ? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
+ 1

what is the situation to use void? can we replace void with int ?

9th Dec 2016, 9:41 AM
sandeep varma yavanamanda
sandeep varma yavanamanda - avatar
3 Antworten
+ 3
you can replace void with int if you want to return something(to be more specific...if you want to return an integer value) void functions doesn't return anything...
9th Dec 2016, 11:04 AM
Adrian Gorea
Adrian Gorea - avatar
+ 1
A void function does not return anything and only runs the code inside it. If you want your function to return a int then replace the void with an int.
14th Dec 2016, 9:29 PM
John K
John K - avatar
0
a void function used where the function doesn't return any value u can also give int at that time but you should also include return0 in the below function
9th Apr 2017, 12:44 AM
Sandesh Virat
Sandesh Virat - avatar