Home Segments Index Top Previous Next

362: Mainline

Combining malloc with sizeof, you can remove the required number of bytes from the free store for an object whose size you do not know. The following, for example, removes a chunk of memory from the free store that is just the right size for holding trade objects; the value returned is the address of that chunk:

malloc (sizeof (struct trade))