If you created a variable of a primitive type like int, char, float inside a function, did you create that variable at runtime or at compile time?
If you created an object inside a function, did you create that object at runtime or at compile time?
If you create an object by memory allocation through heap, did you create that object at runtime or at compile time?
What is static memory allocation and dynamic memory allocation?
You create the variable at run-time, the variable is created when the function is executed, and is destroyed when the function is finished.
Same as above.
If you’re creating an object on the heap, you’re essentially allocating the memory at runtime and get returned a pointer to it. With this pointer, you can read/write to this memory.
Static memory, is memory that only be read from at runtime.
Dynamic memory allocation, refers to allocating objects on the heap and changing them through a pointer to the memory.