void is type of pointer that usually means that you can make it point to any data type.
When you make a pointer point to somewhere its data type should match with the place where you want it to point.
When you dont know the data type where it will point to then you can declare a void pointer and make it point to the data type it want.
Chat with our AI personalities
because void is not return anything every function should have return something void is not return anything so use void
1. pointer: void * is the generic pointer type
2. return value: void means no return value (the default is int)
3. parameter-list: void means no parameters (the default is: unspecified)
void is sort of a "null" type. It can be used to indicate that a function will not return a value or that a pointer has no type applied to it
In C General purpose pointer is called as a void pointer. It doesn't have any data type associated with it. It can store address of any type of variable.
void pointer
When a variable is declared as being a pointer to type void it is known as a generic pointer. Since you cannot have a variable of type void, the pointer will not point to any data and therefore cannot be dereferenced. It is still a pointer though, to use it you just have to cast it to another kind of pointer first. Hence the term Generic pointer.
what is void data type Void is an empty data type normally used as a return type in C/C++, C#, Java functions/methods to declare that no value will be return by the function. The another use of void is to declare the pointer in C/C++ whe It is not sure that what data type will be addressed by the pointer. eg: void *p; Here p can hold the address of int or float or char or long int or double.
void as function return-type means no return value void as function parameter means no parameter void * as pointer type means generic pointer
No, 'void *' and 'double *' are ok; 'void double *' is syntax error.On the other hand 'void **p' is totally correct: p holds the address of a generic pointer.