Hi,
A short question: Is there any way to find what kind of data is stored in a void*?
I've assigned the value of a double to void* p, but sometimes a I have to use int or float. Please advise..
Any ideas or suggestions?
Thanks!
Hi,
A short question: Is there any way to find what kind of data is stored in a void*?
I've assigned the value of a double to void* p, but sometimes a I have to use int or float. Please advise..
Any ideas or suggestions?
Thanks!
Best Regards,
Bill
>>Is there any way to find what kind of data is stored in a void*?
Yes, read your source code.
You can't deference a void pointer.
Does this help?Code:#include <stdio.h> int main(void) { void *vp; float f = 1.1; float *fp; vp = &f; fp = vp; *vp = 1.2; /* Illegal */ *fp = 1.2; /* Legal */ return(0); }
[edit]Beat!
When all else fails, read the instructions.
If you're posting code, use code tags: [code] /* insert code here */ [/code]