I have 2 arrays, one is commented, I would like to make universal printf that will plot the values:
int values [] = { 88, 56, 100, 2, 25 };
//float values[] = {88.5f, 56.5f, 100.0f, 2.234f, 88.12f};
if (value[0] is int) {
for(i; i < 5; ++i)
printf("%d ", *(values + i));
} else {
for(i; i < 5; ++i)
printf("%f ", *(values + i));
}
Is there any way to check it? For example when I wanted to see if element is char or int then I used sizeof
_Generic(values[0], int: 0, float:1, default:2)ito0. And why are you using*(values + i)rather thanvalues[i]?