Say for instance I created a pointer newPtr and I use malloc(some size) and then later I use malloc(some size) again with the same pointer. What happens? Am i then creating
Your program will have a memory leak. The first value of newPtr
will be lost and you will not be able to free
it.
Am i then creating a second block of memory the same size of the first one?
Yes. You are allocating a second object, distinct from the first one.
Does newPtr point to the same address?
No. The objects are distinct, so their address are distinct.