If I have some field **go
and I say *go = malloc(sizeof(whatever))
If go is a field in struct v, how would I achieve the same thing? For example, "v->go = malloc" would be the same thing as go = malloc, but I need *go = malloc.
Whoa! What the hell??
I tried this code, which I assumed would blow up since I'm de-referencing a NULL pointer, but it worked normally. Why isn't it blowing up?
Code:
#include <stdlib.h>
int main( void )
{
char* p = NULL;
int size = sizeof( *p ); /* Why no boom here? */
p = malloc( 5 * size );
return 0;
}
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.