how to know how much size is allocated while dynamically allocating memory to the pointer variable with malloc.
i just write the below code to know the size of ptr2 after dynamically allocating memory.
i want the output is 10 but it is displaying as 2 as( 8 / 4 )
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *ptr2,i;
ptr2=(int*)malloc(10*sizeof(int));//how much size is allocated????
if(ptr2==NULL)
printf("memory allocation failed");
else{
printf("size of *ptr2 is == %d\n",(sizeof(ptr2)/sizeof(int)));
}
}