I know macro can return value of custom type:
#define returnVal(type) ({ \
    type val;              \
    val;                   \
})
I am trying to create a macro which can return custom type pointer by input number. (So it can be dynamic)
// Pseudo code
#define returnPtr(number) ({              \
   // if number == 1, return int *val     \
   // if number == 2, return int **val    \
   // if number == 3, return int ***val   \
})
I tried some approaches but it doesn't work:
#define returnPtr(number) ({                             \
    type = number == 1 ? int * : number == 2 ? int **    \
                                             : int ***;  \
    type val;                                            \
    val;                                                 \
})
How to return custom type pointer by input number in a macro function?
 
    