Modify pointer through void**
Is it legal to access a pointer type through a void **?
I've looked over the standards quotes on pointer aliasing but I'm still
unsure on whether this is legal C or not:
int *array;
void ** vp = (void**)&array;
*vp = malloc(sizeof(int)*10);
Trivial example, but it applies to a more complex situation I'm seeing.
It seems that it wouldn't be legal since I'm accessing an int * through a
type not an int * or char *. I can't come to a simple conclusion on this.
No comments:
Post a Comment