J
J Krugman
Suppose that I have some custom type foo that I know is defined as
a "pointer to something", but I don't know what "something" is.
I want to use malloc to allocate some space for a variable of type
foo to point to. I.e. I want to use malloc to allocate space for
a "something" and assign malloc's return value to a variable of
type foo. But to do this, malloc needs to know the size of a
"something", and I'm stumped. Is there any way for the code to
determine the size of a "something" from foo?
Thanks,
jill
a "pointer to something", but I don't know what "something" is.
I want to use malloc to allocate some space for a variable of type
foo to point to. I.e. I want to use malloc to allocate space for
a "something" and assign malloc's return value to a variable of
type foo. But to do this, malloc needs to know the size of a
"something", and I'm stumped. Is there any way for the code to
determine the size of a "something" from foo?
Thanks,
jill