You are confused with the pointer and memory. When you use malloc you get heap memory of size you request, i.e. a collection of bytes with address range say startAddr and endAddr. Now you have allocated heap memory but how will you access it, since, it is contiguous you just need to know start address (startAddr) and size of memory block (which you already know as you yourself allocated it).
This startAddr is returned by malloc after successful allocation of memory. which you can save in a single pointer or you can copy that address (Not the whole allocated memory) to other pointers.
Now difference between stack and heap memory:
Whenever you declare any variable (pointer is also a variable which stores addresses) which is not global or register or static, it always goes to stack. Heap is only accessible for dynamic allocation and can be accessed by alloc family of functions only.
To conclude:
num1 and num2 both pointers are on stack and hence accessible only inside current function block.
While the address num1 (and num2) is pointing to is in heap memory which is available to whole program, i.e. any other function (or thread in multithreaded program) having this address can access that allocated heap memory.