Here is my problem. I have to create a data structure to overlay an array of unsigned 8-bit values with a floating point variable.
I'm pretty sure I have to use a structure/union, but I don't know where to begin with this. Any pointers, guys?
This is a discussion on Array with a structure within the C Programming forums, part of the General Programming Boards category; Here is my problem. I have to create a data structure to overlay an array of unsigned 8-bit values with ...
Here is my problem. I have to create a data structure to overlay an array of unsigned 8-bit values with a floating point variable.
I'm pretty sure I have to use a structure/union, but I don't know where to begin with this. Any pointers, guys?
Could you clarify the question?
Are you trying to share the same memory with different variables? If so, you're on the right track.
My previous was pointing to some other topic which is called as BitField which is not what u where asking. Sorry about never read your post properly. About the struct overlay.
Well, what is your application of using this overlay, I would be normally used to overlay a register while programming embedded systems. I use it while programming my board. So what is the application of using that in your case.
ssharish
Like that?Code:union test { unsigned char u[8]; float f; };
If I have eight hours for cutting wood, I spend six sharpening my axe.
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.