Here is a dozy of a situation, say I declare a pointer to a structure like this:
The structure contains x and y integer values.
Struct* ptr;
ptr->x = 10;
ptr->y = 35;
Is this valid and why don't I need to use the malloc() function to reserve space for this structure and return a memory address? Is the compilier doing some behind the scenes work for me? Where does the data for this structure end up (stack/heap)?
The structure contains x and y integer values.
Struct* ptr;
ptr->x = 10;
ptr->y = 35;
Is this valid and why don't I need to use the malloc() function to reserve space for this structure and return a memory address? Is the compilier doing some behind the scenes work for me? Where does the data for this structure end up (stack/heap)?