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.
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 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.
Void Pointer is a General purpose pointer ,that does not have any data type associated with it and can store address of any type of variable. Declaration: void * pointer_name;
Void pointer can hold the address of any kind of pointer. But we can't operate on void pointer
void pointer
You don't use 'VOID', but 'void'. It means different things, such as:- void as function type means no return value- void as function parameter means no parameters- 'void *' as pointer-types means generic pointer
Generic pointer of type 'void *' is compatible with any (data-)pointer, but you cannot use the following operators on it: + - ++ -- += -= * -> []
Example: int *pi; void *pv; pv= (void *)pi; pi= (int *)pv;
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.
Pointer to Pointer is a double pointer, denoted by (**). Pointer stores the address of the variable and pointer to pointer stores the address of a pointer variable and syntax can be given as int **ptr2ptr;
The voiddata type is used when a function doesn't return any value, and/or when it has no parameters at all. Pointer type 'void *' is a generic pointer.A void pointer is used when it needs to be assigned to different data types later on in a program. Since it avoids type checking, void pointers should be used with care.