#include<stdio.h>
#include<stdlib.h>
int main ()
{
    int a,n;
    int * ptr_data;
    printf ("Enter amount: ");
    scanf ("%d",&a);
    int arr[a];
    ptr_data = (int*) malloc ( sizeof(int) );
    for ( n=0; n<a; n++ )
    {
        printf ("Enter number #%d: ",n);
        scanf ("%d",&ptr_data[n]);
    }
    for ( n=0; n<a; n++ )
        arr[n] = ptr_data[n]; //values in heap are copied to an array.
    printf("%d\n",sizeof(ptr_data));
    free (ptr_data);
    printf ("Output: ");
    for ( n=0; n<a; n++ )
        printf("%d\n",arr[n]);
    return 0;
}
the sizeof function prints the size of pointer as 4(integer's size). but i run a loop to get the values to be stored in the heap (scanf,.), so how does this subsequent pointee pointer mapping happens after first time? as in, first time i explicitly code that the ptr_data to contain a size of 4. but after that when i want to store another integer this pointer shows another random memory refernce(this mapping explanation is what all i want.)
 
     
     
    