Exercise: Creating Objects via malloc()
Give variable declarations and statements that on the heap will create:
- a string buffer to hold strings of length ≤
K
- a vector of
L double-precision floating point values
- an object of type
Car , defined as:
typedef struct {char rego[7]; float premium;} Car;
|
For each object:
- draw a diagram of what it might look like in memory
- show how you would initialise it to some plausible values
|