What does this mean exactly? It's a variable type declared in a structure. Is this just a pointer variable?
typedef void * variable;
Any material explaining similar to the above code, that would help.
What does this mean exactly? It's a variable type declared in a structure. Is this just a pointer variable?
typedef void * variable;
Any material explaining similar to the above code, that would help.
Disk space: the final frontier
Think of it as a pointer that can point to any data type. The drawback is that you need to know what datatype its pointing to and typecast it before you can use it. For example:
There isn't much you can do with it for straight up applications but for wrapper classes where the user needs more control over the application its a god.Code:void Print(void* DataPtr) { char* text = ((char*)DataPtr); cout << text; } int main() { char* mytext = "asdfasdf"; Print((void*)mytext); }
-"What we wish, we readily believe, and what we ourselves think, we imagine others think also."PHP Code:
sadf
Thanks for your explantion durban, that makes sense. I must add this is 'C Programming' and not 'C++ Programming'.
Last edited by cblix; 11-06-2005 at 07:51 PM.
Disk space: the final frontier
As a note there is no need to cast a void* when assigning it to another pointer. That is a c++ requirement.Originally Posted by durban