I\'m writing an interpreter and I\'d like to be able to store whatever value a function returns into a void pointer. I\'ve had no problem storing ints and various pointers a
Here is it
int main ( ) {
double d = 1.00e+00 ; // 0x3ff0000000000000
double * pd = & d ;
void * * p = ( void * * ) pd ;
void * dp = * p ;
printf ( "%f %p %p %p \n" , d , pd , p , dp ) ;
return 0 ;
} ;
output
1.000000 0x7fff89a7de80 0x7fff89a7de80 0x3ff0000000000000
2nd and 3rd addresses could be different. A shortcut
void * dp = * ( void * * ) & d ;
Cheers