#include enum types { INT, DOUBLE, STRING }; void print(void* var, enum types type) { if (type == INT) { printf("%d\n", *((int*)var)); } if (type == DOUBLE) { printf("%lf\n", *((double*)var)); } if (type == STRING) { printf("%s\n", (char*)var); } } int main() { int a = 123; double b = 2.67; char* c = "wubba lubba dub dub"; print(&a, INT); print(&b, DOUBLE); print(c, STRING); return 0; }