Here is my code:
typedef struct{
int a;
} DATA;
int main()
{
DATA *temp, *temp2;
void *vtemp;
temp = (DATA *)malloc(sizeof(DATA));
temp->a = 5;
vtemp = &temp;
printf("set value : %d\n", temp->a);
// Some ops //
temp2 = (DATA *)vtemp;
printf("got value : %d\n", temp2->a);
return 0;
}
I'm supposed to get "got value" as 5 but i'm getting a random number as follows (probably printing an address?):
set value : 5
got value : 7024656