I wrote up this code to see what would happen after i free up some memory after it has been allocated but I can't understand what is happening here. 

The program asks the user for 3 inputs (via keyboard). It then prints out each input entered and where in memory they are stored. The program then 'frees' the allocated memory and reprints out the new content from the same memory addresses. 

The way I understand it is that once the memory has been 'freed', the previous content stored in there will be deleted and instead be replaced by some random number. This happens in the first two addresses of ptr, but for some reason the third number I entered is always still stored in '&ptr[2]' even after I free(ptr). What is happening here? Why is it not reverting back to a random number as it was before the malloc() was used?

Also i wanted to ask, after the malloc part, is (ptr) exactly the same as (&ptr[0]) ??

```
#include <stdio.h>
#include <stdlib.h>

main ()
{
    int *ptr;
    int req = 3;
    int i;

    ptr = malloc (req * sizeof(*ptr));

    for (i=0; i<req ; i++)
    {
        printf("Please enter a number: ");
        fflush(stdin);
        scanf("%d", &ptr[i]);
    }

    for (i=0; i<req; i++)
    {
        printf("Number #%d is %d and stored in memory address %d\n", (i+1), ptr[i], &ptr[i]);
    }

    free(ptr);

    for (i=0; i<req; i++)
    {
        printf("Number #%d is %d and stored in memory address %d\n", (i+1), ptr[i], &ptr[i]);
    }

}

```