I have made a simulation of a stack using malloc to create an array of MAX elements and assign it to a pointer. I then made a second pointer pointing to the first one, to be able to navigate back and forth, executing pushes and pops.
int * stack= (int *) malloc(MAX * sizeof(*stack));
int * stack_ptr = stack;
In the end, I delete the pointer containing the array, using
free (stack);
After I delete the array (stack), stack_ptr is pointing to an address with no contents, right?
Can this cause a memory leak or any kind of problem, even if the program terminates exactly after?