Unions of the same size and pointers
So I have two union typedefs:
And I have 4 arrays, 2 of each type. I also have a pointer to each array. I have a function that "swaps" the arrays by simply just exchanging the pointers.
typedef union LOWFIXED20_12
int fraction: 12,
typedef union MIDFIXED20_12
int fraction: 8,
Considering that both of these unions are of the same size, int, I was wondering if there was a way to write one function that would take a pointer of either type . . . or do I have to write two separate functions because these are technically of different types?
I know the function is small and fast, but I guess it was more of general question than something that is important to what I am doing.