0

Need help understanding void functions

I dont understand what a void function in c++ is used for besides that it does not return zero. WHAT DOES THAT EVEN MEAN?

6th Sep 2018, 10:29 PM
Adriel Murray
2 Respostas
+ 1
This may help you! When used as the return type for a method, void specifies that the method doesn't return a value. void is also used in an unsafe context to declare a pointer to an unknown type. For more information, see Pointer types. void is an alias for the .NET Framework System.Void type.
6th Sep 2018, 11:17 PM
Lloyd L Conley
Lloyd L Conley - avatar
0
Function can perform some action at it's arguments or it's class without returning a value. For example std::string::clear() makes string empty and don't require to return any value. But in c++ function always should have a return type with only exception for constructors and destructors. So, there is special type void that means nothing.
7th Sep 2018, 2:03 AM
Sergey Ushakov
Sergey Ushakov - avatar