Concept of union

From: Birt (birta_at_imp.com)
Date: 05/30/04


Date: Sun, 30 May 2004 17:41:49 GMT

Could someone help me understand the concept of union?

For example,

typedef union _LARGE_INTEGER
{
 struct {
  DWORD LowPart;
  LONG HighPart;
 };
 LONGLONG QuadPart;
} LARGE_INTEGER, *PLARGE_INTEGER;

How does "union" work in general?

When to use it?

Why have to initialize a LARGE_INTEGER object like:

LARGE_INTEGER li = {2, 4};

instead of

LARGE_INTEGER li = 5;?

Thanks!



Relevant Pages

  • Re: Concept of union
    ... > LONG HighPart; ... > LONGLONG QuadPart; ... union allows you to use the same location in memory to hold different ... struct parts { ...
    (alt.comp.lang.learn.c-cpp)
  • Re: Concept of union
    ... > Could someone help me understand the concept of union? ... > LONG HighPart; ... > LONGLONG QuadPart; ... class CVertex ...
    (alt.comp.lang.learn.c-cpp)