filmov
tv
Structures and Unions in C++ Using Program Example

Показать описание
In today video session we have to discuss two important concepts of C++. These two concepts are used for creating user defined data types in C++. First we will discuss structure and then later in this session we will study union with code example.
Structures and unions both are used as composite user defined data types. There are much similarities in these two types for defining UDT (User Defined Data Type). Here we have also discuss typeof operator in C++ and its use with structures and union.
We can also create array of structure type variables as well as of union type variables.In C++ there is also an anonymous type of union. Anonymous union means there is no identifier specified. To created anonymous union in C++ we have to write the union keyword and list down its data members in body of the union. Pointers to structures in C++ and Arrays of structures in C++ both topics are discussed in detail with practical example. Union is preferable user defined data type when we want to consume less memory and process more data of different type.
Structures and unions both are used as composite user defined data types. There are much similarities in these two types for defining UDT (User Defined Data Type). Here we have also discuss typeof operator in C++ and its use with structures and union.
We can also create array of structure type variables as well as of union type variables.In C++ there is also an anonymous type of union. Anonymous union means there is no identifier specified. To created anonymous union in C++ we have to write the union keyword and list down its data members in body of the union. Pointers to structures in C++ and Arrays of structures in C++ both topics are discussed in detail with practical example. Union is preferable user defined data type when we want to consume less memory and process more data of different type.