T
Tim Cambrant
Hi. I was reading up a bit on the features of C I seldom use, and I came
across unions. I understand the concept, and that all the contained
variables etc. share the same memory. Thus, when a new value is declared to
a variable in the union, the existing value is overwritten even though the
new value is declared to a different variable than that of the first value.
Now I'm just wondering what the use of this is. I'm sure there are lots, so
I'm not critizising, but I just don't see a use for unions. Could someone
give me a few concrete examples of when to use unions?
Thanks.
across unions. I understand the concept, and that all the contained
variables etc. share the same memory. Thus, when a new value is declared to
a variable in the union, the existing value is overwritten even though the
new value is declared to a different variable than that of the first value.
Now I'm just wondering what the use of this is. I'm sure there are lots, so
I'm not critizising, but I just don't see a use for unions. Could someone
give me a few concrete examples of when to use unions?
Thanks.