void PrintArray()
{
int a[4] = {4,3,1,5};
for(int i=0; i<4; i++)
cout<<a[i];
}
What Exactly happens to the memory allocated to the pointer variable 'a' and the 4-integer block pointed to by 'a' after this function's call is completed? Does the memory of the block and pointer variable get de-allocated or does it create some sort of memory leak?
In C, an automatic object like
ais discarded at the exit of the block where it has been declared.