unions re:ridley@obelixuwo.ca (GARY RIDLEY) 
Author Message
 unions re:ridley@obelixuwo.ca (GARY RIDLEY)

>I also have a question regarding the C data type union. I have read/completed
>several text book examples regarding these structures but understanding still
>eludes me. Can someone out there explain to me a real world situation in which
>these structure might be used and be advantageous. I would appreciate the help as
>this seems to be the only sticky point so far in my efforts to master the
>C language.

A union is a variable which may hold objects of different types and
sizes, at different times.
The compiler will keep track of the size and alignment requirments.

The purpose of a union is to provide a single variable which can
legitimately hold any one of several types.

Simply, a union is a structure in which all members have offset zero, the
structure is big enough to hold the widest member, and the alignment is
appropriate for all of the types in the union.

Try lookin back the text book examples for examples of functions which
perform memory allocation (real world situation).

Sat, 24 May 1997 05:53:39 GMT  
 [ 1 post ] 

 Relevant Pages 

1. Gary Kildall

2. Power of Unions ( surely union in C )

3. C# Classes in Los Angeles, CA. ??

4. A c question asked by CA during interview


6. 18/F/CA/PICS/WEBCAM (Read Me)

7. LEEDS - CA-Ingres OpenRoad/RDBMS/C/UNIX Contract - 3-6mths

8. US-CA-SanDiego-C Programmers

9. CA-Temecula- Jr. Software Developer ( 646899 )

10. VINTUG!!! http://www.vintug.bc.ca

11. VINTUG!!! http://www.vintug.bc.ca

12. CA - Los Angeles - C/C++ Programmer Needed


Powered by phpBB® Forum Software