Videos
According to some google searches it says: "void" just means that no data is returned.
Someone explain it so every idiot like me understands. First of all, when do I want data in return and when not? A few examples would do it.
Basically it means "nothing" or "no type"
There are 3 basic ways that void is used:
Function argument:
int myFunc(void)-- the function takes nothing.Function return value:
void myFunc(int)-- the function returns nothingGeneric data pointer:
void* data-- 'data' is a pointer to data of unknown type, and cannot be dereferenced
Note: the void in a function argument is optional in C++, so int myFunc() is exactly the same as int myFunc(void), and it is left out completely in C#. It is always required for a return value.
I have always taken it to mean absent. Here are four cases in the C language that matches to this use of absent
R f(void)- Function parameters are absentvoid f(P)- Return value is absentvoid *p- Type of what is pointed to is absent(void) p- Usage of value is absent
Other C descendants use it for other things. The D programming language uses it for cases where an initializer is absent
T t = void;- initializing value is absent