#include #include #define TYPE_LABEL(value) _Generic((value), int: "int", double: "double", default: "other") /* Requires non-overlapping readable and writable ranges. */ static void copy_readings(int *restrict out, const int *restrict in, size_t count) { for (size_t i = 0; i < count; ++i) { out[i] = in[i]; } } int main(void) { int input[] = {2, 4, 6}; int output[3]; copy_readings(output, input, 3); printf("Copied: %d; type: %s\n", output[2], TYPE_LABEL(output[2])); return 0; }