Can anyone please convert this code from C++ to C OR just give me a C solution for this problem:
Positive number N, find all combinations of 2 * n elements so that each element from 1 to n appears exactly twice and the distance between the two occurrences is equal to the value of the element. For example if n = 3 then we get (3, 1, 2, 1, 3, 2), (2, 3, 1, 2, 1, 3).
In practice, yes: std::numeric_limits<T>::is_iec559 is true on almost all implementations.
In theory, no: the standard does not mandate the object / value representations for floating point types. (Bytes filled with zeroes could turn out to be an invalid value representation or could represent a non-zero value).
In practice: just write a simple, transparent, loop (or use std::uninitialised_fill). And then let the optimiser (it knows what is going on) take care of low-level optimisations.