answersLogoWhite

0

Structures - A tool for handling a group of logically related data. For example:: struct book { char bookname char authorname int no_of_pages } This is a example of structure coz it is logically related to the object books but at the same time, it has diff data types - char int. UNION:: It is juz a concept borrowed from structures. Diff between structure & union is storage. In structure, each member has its own storage location whereas all the members of a union use the same location. Union can handle only one member at a time, coz only one location is allocated for a union, var irrespective of size

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

What is the index of structures and unions in C programming?

There is no such thing. Structs and unions have fields, which can be accessed by their names.


Usage of unions?

Protection from the greed and evil of the company. Answer #2: Given that memory is no more at premium, I really do not see any practical reason to prefer unions over structures.


Similarities between union structure enum in c?

Structures and unions share the following characteristics: * Their members can be objects of any type, including other structures and unions or arrays. A member can also consist of a bit field. * The only operators valid for use with entire structures and unions are the simple assignment (=) and sizeof operators. In particular, structures and unions cannot appear as operands of the equality ( == ), inequality (!=), or cast operators. The two structures or unions in the assignment must have the same members and member types. * A structure or a union can be passed by value to functions and returned by value by functions. The argument must have the same type as the function parameter. A structure or union is passed by value just like a scalar variable; that is, the entire structure or union is copied into the corresponding parameter. similarity is all three are user defined data types.


Why structure variables cannot be compared?

They can be compared with memcmp, but you should be careful if your structures contain:- pointers- alignment gaps- numeric variables (byte order!)- nested structures/unions


What we're the two types of unions formed by American workers?

craft unions and industrial unions


What types of unions are there?

There are four different types of credit unions. They are global credit unions, national credit unions, local credit unions, and employee credit unions.


What are the main types of unions?

Craft or Occupaton Unions, Industrial and General Unions


What event encourage garment workers to join unions?

Labor Unions


What were two types of unions formed by American workers?

Craft unions and industrial unions were two types of unions formed by American workers.


Why did Americans not favor unions?

unions were buttholes


Why did most American not favor unions?

unions were buttholes


What are labor interest groups known as?

Unions are considered labor interests groups. They exists to give employees a voice in their working relationship with their employer.