I am using Code-Blocks with the mingw GCC compiler for windows to code my program in C. I have a function defined where the input is an array of type int. I have another struct defined as
typedef struct {
float re;
float im;
}complex_float;
I want to convert the int type array to a complex_float type array as I need to process the data in the complex_float format. I am using the following pointer method to do the conversion
complex_float *comSig = (complex_float *) sigbuf;
where sigbif is an int pointer pointing to the start address of the integer array.
But when i do a printf("%f",comSig[0].re); I am getting some garbage values like -1.#QNAN0.
I have used this technique for data conversion between arrays a number of times on LINUX and it works. Is this a problem related to the mingw compiler not working clearly or is it related to the fact that I am using an incorrect method for converting an int array to struct array.
I have used this technique for data conversion between arrays a number of times on LINUX and it works.No, it doesn't. That is not a 'technique for data conversion'. You are doing something crazy. Please do not pretend to know what you're doing when you don't because this is just embarrassing.