Can someone simplify this statement from this thead
The original thread is from comp.lang.c. The URL of the thread is:
Can someone clarify the following statement (maybe with some corny example code). I'm just not making the connection.
"I always seem to have problems with structures when they aren't typedef'd. When structures are typedef'd, you can cast values to structure elements and take the size of structure elements without actually having a valid, allocated, and filled data structure. For example, say you have three structures which should be nested but are separate. Now, you need some data
from the third structure. But, you have a raw buffer that corresponds to the first structure, and, of course, contains the data for second and third structures. How do you get to the data in the third structure? Using typedef'd structures and casts, you can access the data from the third structure in the raw buffer without allocating space for or filling in the structures. You only need to allocate space for the raw buffer and variables which are assigned data from the third structure. You have total
access to any data in the raw buffer, but you don't need to allocate and fill any intermediate structures. "