Tried following code to check what happens when we convert integer pointer to a integer .
#include<stdio.h>
#include<stdlib.h>
int main()
{
int *p;
int a;
p = (int *)malloc(sizeof(int));
*p = 10;
a = (int)p;
printf("%d\n",*p);
printf("%d \n",a);
return 0;
}
The output is : 10
135680008
Can anyone explain, the concept related to this conversion? Any links provided related to this topic would also be helpful.
free( p )
after you don't need it anymore.