Is the following considered bad practice in C?
void (* print_function) (void *obj); Item1 *item1 = & (Item1) {.id=123}; print_function = print_item1; print_function(item1); Item2 *item2 = & (Item1) {.guid="X1-283"}; print_function = print_item2; print_function(item2);
That is, trying to pass different objects multiple places by using void *? If so, why?
void *
2.1m questions
2.1m answers
60 comments
57.0k users