I want to understand free() in c deallocates memory or it simply erases the data in the allocated memory by malloc.
#include<stdio.h>
#include<stdlib.h>
int main()
{
int n;
printf("enter the size of n:\n");
scanf("%d", &n);
int* A=(int*)malloc(5*sizeof(int));
int i;
for(i=0; i<n; i++)
{
printf("%d\n", &A[i]);
}
free(A);
printf("\n\n-------------\n\n");
for(i=0; i<n; i++)
{
printf("%d\n", &A[i]);
}
return 0;
}
Still after freeing A its giving the same address of A. What free() actually do?