This document discusses data structures and structures in C++. It explains that structures allow you to group together different data types under one name and can be used to represent databases. Structures contain member variables of different types, which can be accessed using the dot operator. Structures can be initialized, arrays of structures can be declared, and structures can contain other structures as members. Pointers to structures and arrays of structures are also discussed.
Structures in C
What is a structure?
A structure is a user defined data type in C/C++. A structure creates a data type that can be used to group items of possibly different types into a single type.
Structures in C allow the user to define a custom data type that combines different data types to represent a record. A structure is similar to an array but can contain heterogeneous data types, while an array only holds the same type. Structures are defined using the struct keyword followed by structure tags and member lists. Structure variables are declared like other variables and members can be accessed using the dot operator. Arrays of structures and nested structures are also supported.
Structures allow the grouping of different data types under a single name for easier handling. A structure is declared using the struct keyword followed by the structure name and members inside curly braces. Structure members can be of similar or different data types. Structure variables are then declared using the structure name. This allows storing multiple related data under one variable name. Arrays differ in that they contain elements of the same data type, while structures can mix data types.
This document discusses structures in C programming. It defines a structure as a collection of variables under a single name that provides a way to group related data. Structures allow heterogeneous data of different types to be stored together. The document covers defining and declaring structure types and variables, initializing structure members, using pointers to structures, and aggregate and segregate operations on structures like accessing members and taking the address of a structure.
Introduction, Array of structure, Passing structure to function, Passing array of structure to function, Structure within structure ( Nested Structure), Union, Pointer to structure
This document discusses structures in C++. It defines a structure as a collection of variables under a single name where the variables can be of different data types. It provides an example of declaring a structure with three variables of different types. It also discusses how to declare a structure variable which allocates memory, and how to access structure members using the dot operator. The document notes that structures can be nested within other structures and that arrays can contain structures or structures can contain arrays. It discusses passing structures to functions by value and by reference. Finally, it briefly introduces typedef, enumerated data types, and practice questions related to structures.
Structures allow grouping of related data and can be used to represent records. A structure defines a template for the format of its members. Structures can contain basic data types and arrays. Structure variables can be initialized, and members accessed using dot operator. Arrays of structures can be used to represent tables of related data. Unions share the same storage location for members, allowing only one member to be active at a time. Both structures and unions can be used as function parameters.
This document contains a summary of structures in C programming language. It defines what a structure is, how to declare and define a structure with members, and how to access structure members using the dot operator. It also discusses nested structures, arrays of structures, and provides an example of a program that uses a structure to prepare student mark statements. Key points covered include declaring and defining structures, accessing structure members, nested structures, arrays of structures, and an example program to print student marks statements using a structure.
The document discusses structures and unions in C. Structures allow organizing related data of different types under a single name, while unions share the same memory location for members. The document covers defining and initializing structures, accessing structure members, arrays of structures, nested structures, and unions. It provides examples of declaring and using structures and unions, as well as comparing and passing structures to functions.
1. A structure is a collection of variables under a single name. Variables within a structure can be of different data types like int, float, etc.
2. To declare a structure, the keyword struct is used followed by the structure name in braces. To define a structure variable, the data type is the structure name followed by the variable name.
3. Structure members are accessed using the dot operator between the structure variable name and member name.
Structures allow grouping related data types together under a single name. They can contain elements of different data types. The smallest element in a structure is called a field. Structures and unions allow defining complex data types that can make code more readable. Unions share the same memory location for different data types, while structures contain all elements simultaneously using separate memory locations for each.
This document discusses structures and unions in C programming. It defines a structure as a user-defined data type that groups elements of different data types together under a single name. Structures allow members to be accessed and processed separately. Unions are similar to structures but all members share the same memory location, whereas structure members each have their own location. The document provides examples of defining, initializing, accessing structure members, passing structures to functions, pointers to structures, arrays of structures, and nested structures. It also compares the differences between structures and unions in terms of memory usage and member access.
The document discusses structures in C programming. A structure allows grouping of different data types together under one name to represent a record. It defines a structure called "book" with members like title, author, pages, and price to represent a book database. Structure variables can then be declared of this type to store book records. Members of a structure variable can be accessed using the dot operator and assigned values individually.
Union allows different data types to share the same memory location. It allocates enough memory to hold the largest member. While structures allocate separate memory for each member, unions share the same memory so only one member can be active at a time. For example, a union could hold an integer or float in the same memory space. Unions are useful for reducing memory usage but require careful use since writing to one member can overwrite another member's value.
Structures in C allow grouping of different data types together under one name. A structure contains members of possibly different types, while an array contains elements all of the same type. To declare a structure, the struct keyword is used followed by a tag name and a list of members. Individual members can then be accessed using the dot operator. Structures can also be nested, so members of one structure can be other structures. Structures provide a way to bundle data together and are useful for representing complex, real world entities like an account with fields for number, name, balance etc.
This document discusses C structures, including defining and declaring structures, structure members, arrays of structures, initializing structures, and pointers to structures. Some key points:
- Structures allow combining different data types into a single unit/object. Members can include basic types, arrays, pointers, and other structures.
- Structures are defined using the struct keyword followed by a tag name and a list of members. Variables of the structure type are then declared referring to the tag.
- Individual structure members can be accessed using the dot (.) operator and pointers to structures use arrow (->) operator to access members.
- Arrays of structures define an array where each element is a structure, allowing multiple structure objects
Structures are used to organize related data items into a single unit. A structure defines members for storing logically related data and structure variables can then be declared to store actual data. Structure members are accessed using the dot operator with the variable name and member name. Arrays of structures and structures within structures can also be defined.
Structures are used to organize related data items into a single unit. A structure defines members for storing logically related data and structure variables can then be declared to store actual data. Structure members are accessed using the dot operator with the variable name and member name. Arrays of structures and structures within structures can also be defined.
This document discusses C structs, unions, typedefs, and enums. It provides examples of declaring structs with different data types as members, nested structs, anonymous structs, arrays of structs, and bit fields. It also demonstrates accessing struct members using dot and arrow operators, passing structs to functions, and typedefs for defining new data types. The key topics covered include declaring and defining struct templates, initializing struct variables, and aligning bit fields in structs.
Structure basics
Declaring and defining a structure
Attributes of structure
Nested structures
Arrays as structure members
Arrays of structure
Passing arrays as arguments to structure
Union
Declaration defining and accessing.
Bit fields
Enumerated data types
reference:
1."Computer Fundamentals & Programming", Sumitabha Das.
2. Geeks for Geeks
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
BASIC ALGORITHMS
SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.), BASIC SORTING ALGORITHMS (BUBBLE, INSERTION AND SELECTION), FINDING ROOTS OF EQUATIONS, NOTION OF ORDER OF COMPLEXITY THROUGH EXAMPLE PROGRAMS (NO FORMAL DEFINITION REQUIRED)
Geography Sem II Unit 1C Correlation of Geography with other school subjectsProfDrShaikhImran
The correlation of school subjects refers to the interconnectedness and mutual reinforcement between different academic disciplines. This concept highlights how knowledge and skills in one subject can support, enhance, or overlap with learning in another. Recognizing these correlations helps in creating a more holistic and meaningful educational experience.
APM event hosted by the Midlands Network on 30 April 2025.
Speaker: Sacha Hind, Senior Programme Manager, Network Rail
With fierce competition in today’s job market, candidates need a lot more than a good CV and interview skills to stand out from the crowd.
Based on her own experience of progressing to a senior project role and leading a team of 35 project professionals, Sacha shared not just how to land that dream role, but how to be successful in it and most importantly, how to enjoy it!
Sacha included her top tips for aspiring leaders – the things you really need to know but people rarely tell you!
We also celebrated our Midlands Regional Network Awards 2025, and presenting the award for Midlands Student of the Year 2025.
This session provided the opportunity for personal reflection on areas attendees are currently focussing on in order to be successful versus what really makes a difference.
Sacha answered some common questions about what it takes to thrive at a senior level in a fast-paced project environment: Do I need a degree? How do I balance work with family and life outside of work? How do I get leadership experience before I become a line manager?
The session was full of practical takeaways and the audience also had the opportunity to get their questions answered on the evening with a live Q&A session.
Attendees hopefully came away feeling more confident, motivated and empowered to progress their careers
Ad
More Related Content
Similar to structure and union from c programming language.ppt (20)
Structures allow grouping of related data and can be used to represent records. A structure defines a template for the format of its members. Structures can contain basic data types and arrays. Structure variables can be initialized, and members accessed using dot operator. Arrays of structures can be used to represent tables of related data. Unions share the same storage location for members, allowing only one member to be active at a time. Both structures and unions can be used as function parameters.
This document contains a summary of structures in C programming language. It defines what a structure is, how to declare and define a structure with members, and how to access structure members using the dot operator. It also discusses nested structures, arrays of structures, and provides an example of a program that uses a structure to prepare student mark statements. Key points covered include declaring and defining structures, accessing structure members, nested structures, arrays of structures, and an example program to print student marks statements using a structure.
The document discusses structures and unions in C. Structures allow organizing related data of different types under a single name, while unions share the same memory location for members. The document covers defining and initializing structures, accessing structure members, arrays of structures, nested structures, and unions. It provides examples of declaring and using structures and unions, as well as comparing and passing structures to functions.
1. A structure is a collection of variables under a single name. Variables within a structure can be of different data types like int, float, etc.
2. To declare a structure, the keyword struct is used followed by the structure name in braces. To define a structure variable, the data type is the structure name followed by the variable name.
3. Structure members are accessed using the dot operator between the structure variable name and member name.
Structures allow grouping related data types together under a single name. They can contain elements of different data types. The smallest element in a structure is called a field. Structures and unions allow defining complex data types that can make code more readable. Unions share the same memory location for different data types, while structures contain all elements simultaneously using separate memory locations for each.
This document discusses structures and unions in C programming. It defines a structure as a user-defined data type that groups elements of different data types together under a single name. Structures allow members to be accessed and processed separately. Unions are similar to structures but all members share the same memory location, whereas structure members each have their own location. The document provides examples of defining, initializing, accessing structure members, passing structures to functions, pointers to structures, arrays of structures, and nested structures. It also compares the differences between structures and unions in terms of memory usage and member access.
The document discusses structures in C programming. A structure allows grouping of different data types together under one name to represent a record. It defines a structure called "book" with members like title, author, pages, and price to represent a book database. Structure variables can then be declared of this type to store book records. Members of a structure variable can be accessed using the dot operator and assigned values individually.
Union allows different data types to share the same memory location. It allocates enough memory to hold the largest member. While structures allocate separate memory for each member, unions share the same memory so only one member can be active at a time. For example, a union could hold an integer or float in the same memory space. Unions are useful for reducing memory usage but require careful use since writing to one member can overwrite another member's value.
Structures in C allow grouping of different data types together under one name. A structure contains members of possibly different types, while an array contains elements all of the same type. To declare a structure, the struct keyword is used followed by a tag name and a list of members. Individual members can then be accessed using the dot operator. Structures can also be nested, so members of one structure can be other structures. Structures provide a way to bundle data together and are useful for representing complex, real world entities like an account with fields for number, name, balance etc.
This document discusses C structures, including defining and declaring structures, structure members, arrays of structures, initializing structures, and pointers to structures. Some key points:
- Structures allow combining different data types into a single unit/object. Members can include basic types, arrays, pointers, and other structures.
- Structures are defined using the struct keyword followed by a tag name and a list of members. Variables of the structure type are then declared referring to the tag.
- Individual structure members can be accessed using the dot (.) operator and pointers to structures use arrow (->) operator to access members.
- Arrays of structures define an array where each element is a structure, allowing multiple structure objects
Structures are used to organize related data items into a single unit. A structure defines members for storing logically related data and structure variables can then be declared to store actual data. Structure members are accessed using the dot operator with the variable name and member name. Arrays of structures and structures within structures can also be defined.
Structures are used to organize related data items into a single unit. A structure defines members for storing logically related data and structure variables can then be declared to store actual data. Structure members are accessed using the dot operator with the variable name and member name. Arrays of structures and structures within structures can also be defined.
This document discusses C structs, unions, typedefs, and enums. It provides examples of declaring structs with different data types as members, nested structs, anonymous structs, arrays of structs, and bit fields. It also demonstrates accessing struct members using dot and arrow operators, passing structs to functions, and typedefs for defining new data types. The key topics covered include declaring and defining struct templates, initializing struct variables, and aligning bit fields in structs.
Structure basics
Declaring and defining a structure
Attributes of structure
Nested structures
Arrays as structure members
Arrays of structure
Passing arrays as arguments to structure
Union
Declaration defining and accessing.
Bit fields
Enumerated data types
reference:
1."Computer Fundamentals & Programming", Sumitabha Das.
2. Geeks for Geeks
C Programming Language is the most popular computer language and most used programming language till now. It is very simple and elegant language. This lecture series will give you basic concepts of structured programming language with C.
BASIC ALGORITHMS
SEARCHING (LINEAR SEARCH, BINARY SEARCH ETC.), BASIC SORTING ALGORITHMS (BUBBLE, INSERTION AND SELECTION), FINDING ROOTS OF EQUATIONS, NOTION OF ORDER OF COMPLEXITY THROUGH EXAMPLE PROGRAMS (NO FORMAL DEFINITION REQUIRED)
Geography Sem II Unit 1C Correlation of Geography with other school subjectsProfDrShaikhImran
The correlation of school subjects refers to the interconnectedness and mutual reinforcement between different academic disciplines. This concept highlights how knowledge and skills in one subject can support, enhance, or overlap with learning in another. Recognizing these correlations helps in creating a more holistic and meaningful educational experience.
APM event hosted by the Midlands Network on 30 April 2025.
Speaker: Sacha Hind, Senior Programme Manager, Network Rail
With fierce competition in today’s job market, candidates need a lot more than a good CV and interview skills to stand out from the crowd.
Based on her own experience of progressing to a senior project role and leading a team of 35 project professionals, Sacha shared not just how to land that dream role, but how to be successful in it and most importantly, how to enjoy it!
Sacha included her top tips for aspiring leaders – the things you really need to know but people rarely tell you!
We also celebrated our Midlands Regional Network Awards 2025, and presenting the award for Midlands Student of the Year 2025.
This session provided the opportunity for personal reflection on areas attendees are currently focussing on in order to be successful versus what really makes a difference.
Sacha answered some common questions about what it takes to thrive at a senior level in a fast-paced project environment: Do I need a degree? How do I balance work with family and life outside of work? How do I get leadership experience before I become a line manager?
The session was full of practical takeaways and the audience also had the opportunity to get their questions answered on the evening with a live Q&A session.
Attendees hopefully came away feeling more confident, motivated and empowered to progress their careers
"Basics of Heterocyclic Compounds and Their Naming Rules"rupalinirmalbpharm
This video is about heterocyclic compounds, which are chemical compounds with rings that include atoms like nitrogen, oxygen, or sulfur along with carbon. It covers:
Introduction – What heterocyclic compounds are.
Prefix for heteroatom – How to name the different non-carbon atoms in the ring.
Suffix for heterocyclic compounds – How to finish the name depending on the ring size and type.
Nomenclature rules – Simple rules for naming these compounds the right way.
Common rings – Examples of popular heterocyclic compounds used in real life.
Link your Lead Opportunities into Spreadsheet using odoo CRMCeline George
In Odoo 17 CRM, linking leads and opportunities to a spreadsheet can be done by exporting data or using Odoo’s built-in spreadsheet integration. To export, navigate to the CRM app, filter and select the relevant records, and then export the data in formats like CSV or XLSX, which can be opened in external spreadsheet tools such as Excel or Google Sheets.
GDGLSPGCOER - Git and GitHub Workshop.pptxazeenhodekar
This presentation covers the fundamentals of Git and version control in a practical, beginner-friendly way. Learn key commands, the Git data model, commit workflows, and how to collaborate effectively using Git — all explained with visuals, examples, and relatable humor.
*Metamorphosis* is a biological process where an animal undergoes a dramatic transformation from a juvenile or larval stage to a adult stage, often involving significant changes in form and structure. This process is commonly seen in insects, amphibians, and some other animals.
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingCeline George
The Accounting module in Odoo 17 is a complete tool designed to manage all financial aspects of a business. Odoo offers a comprehensive set of tools for generating financial and tax reports, which are crucial for managing a company's finances and ensuring compliance with tax regulations.
The *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responThe *nervous system of insects* is a complex network of nerve cells (neurons) and supporting cells that process and transmit information. Here's an overview:
Structure
1. *Brain*: The insect brain is a complex structure that processes sensory information, controls behavior, and integrates information.
2. *Ventral nerve cord*: A chain of ganglia (nerve clusters) that runs along the insect's body, controlling movement and sensory processing.
3. *Peripheral nervous system*: Nerves that connect the central nervous system to sensory organs and muscles.
Functions
1. *Sensory processing*: Insects can detect and respond to various stimuli, such as light, sound, touch, taste, and smell.
2. *Motor control*: The nervous system controls movement, including walking, flying, and feeding.
3. *Behavioral responses*: Insects can exhibit complex behaviors, such as mating, foraging, and social interactions.
Characteristics
1. *Decentralized*: Insect nervous systems have some autonomy in different body parts.
2. *Specialized*: Different parts of the nervous system are specialized for specific functions.
3. *Efficient*: Insect nervous systems are highly efficient, allowing for rapid processing and response to stimuli.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive in diverse environments.
The insect nervous system is a remarkable example of evolutionary adaptation, enabling insects to thrive
How to track Cost and Revenue using Analytic Accounts in odoo Accounting, App...Celine George
Analytic accounts are used to track and manage financial transactions related to specific projects, departments, or business units. They provide detailed insights into costs and revenues at a granular level, independent of the main accounting system. This helps to better understand profitability, performance, and resource allocation, making it easier to make informed financial decisions and strategic planning.
A measles outbreak originating in West Texas has been linked to confirmed cases in New Mexico, with additional cases reported in Oklahoma and Kansas. The current case count is 817 from Texas, New Mexico, Oklahoma, and Kansas. 97 individuals have required hospitalization, and 3 deaths, 2 children in Texas and one adult in New Mexico. These fatalities mark the first measles-related deaths in the United States since 2015 and the first pediatric measles death since 2003.
The YSPH Virtual Medical Operations Center Briefs (VMOC) were created as a service-learning project by faculty and graduate students at the Yale School of Public Health in response to the 2010 Haiti Earthquake. Each year, the VMOC Briefs are produced by students enrolled in Environmental Health Science Course 581 - Public Health Emergencies: Disaster Planning and Response. These briefs compile diverse information sources – including status reports, maps, news articles, and web content– into a single, easily digestible document that can be widely shared and used interactively. Key features of this report include:
- Comprehensive Overview: Provides situation updates, maps, relevant news, and web resources.
- Accessibility: Designed for easy reading, wide distribution, and interactive use.
- Collaboration: The “unlocked" format enables other responders to share, copy, and adapt seamlessly. The students learn by doing, quickly discovering how and where to find critical information and presenting it in an easily understood manner.
CURRENT CASE COUNT: 817 (As of 05/3/2025)
• Texas: 688 (+20)(62% of these cases are in Gaines County).
• New Mexico: 67 (+1 )(92.4% of the cases are from Eddy County)
• Oklahoma: 16 (+1)
• Kansas: 46 (32% of the cases are from Gray County)
HOSPITALIZATIONS: 97 (+2)
• Texas: 89 (+2) - This is 13.02% of all TX cases.
• New Mexico: 7 - This is 10.6% of all NM cases.
• Kansas: 1 - This is 2.7% of all KS cases.
DEATHS: 3
• Texas: 2 – This is 0.31% of all cases
• New Mexico: 1 – This is 1.54% of all cases
US NATIONAL CASE COUNT: 967 (Confirmed and suspected):
INTERNATIONAL SPREAD (As of 4/2/2025)
• Mexico – 865 (+58)
‒Chihuahua, Mexico: 844 (+58) cases, 3 hospitalizations, 1 fatality
• Canada: 1531 (+270) (This reflects Ontario's Outbreak, which began 11/24)
‒Ontario, Canada – 1243 (+223) cases, 84 hospitalizations.
• Europe: 6,814
2. Objective
Definition of Structure
Declaring structure variable
Accessing Structure members
Structure initialization
Array of structure
Array within structure
Structure within structure
Union
Union vs. Structure
3. Definition of structure
1. A collection of variables that are functionally related to each
other.
2. Each variable that is a member of the structure has a specific
type.
3. Different members of the structure may have either the same
or different types. Cf. the elements of an array, which must all
be of one type.
4. A structure is a derived data type, constructed from two or
more objects of one or more individual types.
5. The entire structure may bear a name.
6. Each member of the structure must [also] have a name.
7. The scope of the name of a structure member is limited to the
structure itself and also to any variable declared to be of the
structure's type.
4. Continue…
8. THEREFORE, different structures may contain members
having the same name; these may be of the same or of
different types.
9. A self-referential structure contains a member which is a
pointer to the same structure type.
10. Declaration of the structure merely defines the new data
type; space is NOT reserved in memory as a result of the
declaration.
(However, declaration of the structure does define how
much memory is needed to store each variable
subsequently declared to be of the type of the defined
structure.)
8. Structure declaration -3
struct /* NO NAME ASSIGNED TO THE TYPE */
{
typeOfFirstMember nameOfFirstMember;
typeOfSecondMember nameOfSecondMember;
typeOfThirdMember nameOfThirdMember;
. . .
} variable1OfThisStructureType, variable2OfThisStructureType, . . .;
Example
Struct
{
char name;
float price;
int page;
} b1,b2,b3;
9. Accessing Structure members
To access structure members we have to (.)operator.
variable1OfTheStructureType.nameOfTheMember
Example
b1.page
b2.price
10. Structure initialization
A structure can be initialize by the following way,
Watch this example.
Example
struct book
{
char name;
float price;
int pages;
};
struct book b1={‘B’, 130.00, 550 }; //structure initialization
11. Simple structure program
#include<stdio.h>
void main()
{
struct book
{
char name;
float price;
int pages;
};
struct book b1={‘B’, 130.00, 550 };
printf(“n book name is:%c”,b1.name);
printf(“n book price is: %f”,b1.price);
printf(“n book pages are: %d”,b1.pages);
}
12. Array of structure
Array of structure is possible in c language. If
you declare a array of structure then the
variables of the structure type will be stored in
continuous memory locations. An example of
declaring an array of structure is given below.
struct book
{
char name;
float price;
int pages;
};
struct book b[100]; //declaration of array of structure
13. Sample program of array of structure
#include<stdio.h>
void main()
{
struct book
{
char name;
float price;
int pages;
};
struct book b[100];
int i;
for(i=0;i<=99;i++)
{
printf(“n Enter name, price and pages”);
scanf(“%c %f %d”, &b [i].name,&b[i].price,&b[i].pages);
}
for(i=0;i<=99;i++)
printf(“n %c %f %d”, b[i].name,b[i].price,b[i].pages);
}
14. Array within structure
Array can exist as a member of structure. A
simple example is given below.
struct book
{
char name[100]; //Array within structure
float price;
int pages;
};
struct book b1;
15. Structure within structure
A structure itself can be member of another structure.
This is given in the following example.
Struct employee
{
char name[100];
char department[20];
struct
{
int dearness;
int house_rent;
int city;
}allowance;
}emp1,emp2,emp3;
16. Union
What is union?
1. Like a structure, a union is also a derived data type.
2. The members of a union share a single storage space.
3. Only ONE member of each union can be referenced t
a time.
4. Amount of space allocated for storage is the amount
needed for the largest member of the union.
17. Example of union
union book
{
char name;
float price;
int pages;
};
This will take memory space of 4 bytes, since
price(datatype is float which is of 4 bytes) is the
largest member in this union. This 4 byte is shared by
all the members in the union. Only 1 member of this
union can be referenced at a time
18. Union vs. Structure
1. struct keyword required to declare a structure, union
keyword required to declare a union.
2. Every structure member is allocated memory when a
structure variable is defined. whereas in union the memory
equivalent to largest item that is allocated commonly for all
members.
3. In union only one member can assign values at a time. But
in structure all the members can assign at a time.
4. memory can be allocated dynamically in structure, where as
in union can not be allocated dynamically.
5. In structures value assigned to one member cannot cause
the change in other members ,where as in union it cause
change in values of other members.
6. Self referential structure is possible, But self referential
union is not possible.