navbar brand

Question

21 Mar 2023, Tue
  • Applications
    Dictionary
    Quiz
    Converter
  • User Profile
    • image profile

      Hello Guest 👋 !

      Login Register
UI
Namaste, Guest Become a member?
  • Login
  • Register
  • Ask Question
  • Questions

    • Ask Question
    • All Subjects
    • Accountancy
    • Astronomy
    • Biology
    • Business Studies
    • Chemistry
    • Computer
    • Digital Marketing
    • Economics
    • Engineering Aptitude
    • English
    • Entertainment
    • Environment
    • Geography
    • Geology
    • Health
    • History
    • Language
    • Math
    • Nepali
    • Optional Math
    • Physics
    • Population
    • Social Studies
    • Super Natural
    • The Heritage of Words
  • Quick Access

    • Home
    • Questions
    • Profile
  • Exam Capsule

    • All Entrances
    • IOE Entrance
    • SEE Model Set
  • MCQ

    • GK Practice
    • Categories
    • Exam
    • Submit Quiz
  • Articles

    • Essay Contest
    • Latest
    • Health
    • Education
    • Sports
    • Abroad
    • Politics
    • Environment
    • Technology
  • Institutes

    • All Institutes
    • Schools
    • High Schools
    • Colleges
    • Tuition Centers
    • Library
  • Notices

    • Admission Open
    • Result
    • Loksewa
  • Top Topics

    • Electricity
    • Computer Fundamentals
    • Pressure
    • Heat
    • Waves
Toolbox
  • Dictionary
    Dictionary
  • Calculator
    Calculator
Bipina Poudel
3 years ago Grade -12 (NEB) > Science Computer

Differences between Structure and union

What are the different between Structure and Union?

Share My Answer
  • Differences between Structure and union
  • structure
  • structure and union
  • Union
2

2 Answers

Ramos Sapkota
3 years ago Answer Link Tribhuvan University > Faculty of Humanities and Social Sciences > BCA (Bachelor in Computer Application)
S.N Structure S.N Union
1. You can use a struct keyword to define a structure. 1. You can use a union keyword to define a union.
2. Every member within structure is assigned a unique memory location. 2. In union, a memory location is shared by all the data members.
3. Changing the value of one data member will not affect other data members in structure. 3. Changing the value of one data member will change the value of other data members in union.
4. The total size of the structure is the sum of the size of every data member. 4. The total size of the union is the size of the largest data member.
5. It occupies space for each and every member written in inner parameters. 5. It occupies space for a member having the highest size written in inner parameters.
6. You can retrieve any member at a time. 6. You can access one member at a time in the union.
0

Comments

Bipina Poudel
3 years ago Answer Link CTEVT > Diploma/PCL > PCL In Medical Lab Technology Revised 2019
S.N Structure Union
1. It occupies the total memory space required by all its members. It occupies the memory space equal to the requirement of its largest member.
2. It requires a large memory space. It requires a smaller memory space.
3. It can take part in a complex data structure. It cannot take part in complex data structures.
4. Keyword struct is required to declare structure A keyword union is required to declare a union.
5.

eg:

struct student{
char name[20];
int age;
};
struct s1;

eg:

struct student{
char name[20];
int age;
};
union s1;

 

6. The above declaration reserves 20+2=22 Bytes memory space. The above declaration reserves 20 Bytes memory space.
7.

Syntax of structure:

struct user_defined_name
{
data_type member1;
data_type member2;
...........................
data_type member;
};
struct user defined_name
var1, var2............

Syntax of the union:

union user_defined_name
{
data_type member1;
data_type member2;
...........................
data_type member;
};
struct user defined_name
var1, var2............

0

Comments

Topics from Computer

System Development Concept 2 Artificial Intelligence 4 file handling 44 Introduction to Digital Marketing 0 Modular programming 50 Number System 1 Object-Oriented Programming (OOP) 8 Office Personnel 1 Database 4 Q basic programming 72 Computer Fundamentals 141

Related Questions

  • Who is a system analyst? What are the characteristics of system analysts? 1

  • What are the different stages of the system development life cycle (SDLC) 1

  • What are cyber law and Artificial Intelligence? Explain. 1

  • What are the applications of AI? Explain. 1

  • What do you understand about AI? What are the negative and positive aspects of AI in society? 1

  • How does an AI application work? Can a computer really think with the aid of AI? 1

  • Explain class and Object in Object-Oriented Programming. 1

  • What is the importance of OOP? 1

  • What is procedural programming? Explain. 1

  • What are the advantages and disadvantages of OOP? 1

Popular Tags: 7 Days

  • development
  • political change
  • mediterranean climate region
  • winter rainfall
  • compound interest
  • Advantages of saving
  • egg sinks in pure water but floats in the salt solution
  • Cooperative
  • principles
  • functions of Legislature
  • secular
  • secular country
  • secularism
  • secularism in nepal

Upcoming MCQs

MCQ Online Exam

Computer Fundamental Multiple Choice Questions Exam Free

  • 2022-03-20 12:45
  • 60 Mins
  • 12 Enrolled
  • 25 Full Marks
  • 10 Pass Makrs
  • 25 Questions

Search

Quick Links
  • About Us
  • Terms of Use
  • Privacy Policy
  • Cookie Policy
  • Advertise With Us
  • FAQs
Our Products
  • Educational Institutes
  • Question & Answers Community
  • Online Course/Notes
  • Educational Utilities
  • Social Networking
  • Educational Store
Contact Us
Address:
Pryag Pokhari, Lagankhel, Lalitpur Nepal
Email:
[email protected]
Phones:
9745619281 or +977-9840704915

PathshalaNepal.com is a Registered Company of E. Pathshala Pvt Ltd Nepal. Registration number : 289280

© 2020. All right Reversed.E. Pathshala Pvt Ltd