This may seem like a very basic question, but its been in my head so:
When we allocate a local variable, it goes into stack. Similarly dynamic allocation cause the v
The pointer variable itself would reside on the stack. The memory that the pointer points to would reside on the heap.
int *i = malloc(sizeof(int));
i would reside on the stack, the actual memory that i points to *i would be on the heap.
i
*i