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?
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; };
All problems in computer science can be solved by another level of indirection,
except for the problem of too many layers of indirection.
– David J. Wheeler
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.