MACRO Question: Returning pointer to a certain value
- by Andrei Ciobanu
Is it possible to write a MACRO that has a type and a value as its input parameters (MACRO(type,value)), and returns a valid pointer to a location that holds the submitted value.
This macro should perform like the following function, but in a more generic manner:
int *val_to_ptr(int val){
int *r = NULL;
r = nm_malloc(sizeof(*r));
*r =…