1 / 3

Unions

Unions. Defining , Initializing, and Using. Unions. Unions are similar to structures are made up of different types of elements, but unlike structures, all elements point to the same memory location. The amount of memory allocated for a union is the longest element inside the union. Unions.

Download Presentation

Unions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Unions Defining , Initializing, and Using

  2. Unions • Unions are similar to structures are made up of different types of elements, but unlike structures, all elements point to the same memory location. • The amount of memory allocated for a union is the longest element inside the union. CENG 114

  3. Unions • Defining a union: union grade { int a; /* 4 bytes */ double b; /* 8 bytes */ } b a 6.24 5 x.a = 5; x.b = 6.24; x CENG 114

More Related