Union in C programming | Structure vs Union

preview_player
Показать описание

A union is a user-defined type similar to structs in C except for one key difference. Structures allocate enough space to store all their members, whereas unions can only hold one member value at a time.

► Programming in C (Complete Playlist):

Other subject-wise playlist Links:
--------------------------------------------------------------------------------------------------------------------------------------
►Design and Analysis of algorithms (DAA):
►Database Management System:
► Theory of Computation
►Artificial Intelligence:
►Computer Networks (Complete Playlist):
►Operating System:
►Structured Query Language (SQL):
►Discrete Mathematics:
►Compiler Design:
►Number System:
►Cloud Computing & BIG Data:
►Software Engineering:
►Data Structure:
►Computer Architecture :
►Graph Theory (Complete Playlist):
►Digital Logic:

---------------------------------------------------------------------------------------------------------------------------------------
Our social media Links:
--------------------------------------------------------------------------------------------------------------------------------------
►For Any Query, Suggestion or notes contribution:
Рекомендации по теме
Комментарии
Автор

I used to watch your videos during clg, today i watched your video again for an interview preparation. It reminded me of those clg days and i used to watch your videos day and night before exam. You're doing great job sir :)

anjalimeena
Автор

Thankyou because of u all topic clear dont stop doing urs all subjects are beautiful

poojapoojadhapte
Автор

one of the best video explaining union briefly...thank you sir

divyanshjain
Автор

thanks sir for everything
im watching your every videos Thanks for this content 🤩🤩🤩

rupesh_gamer
Автор

Thanks sir your teaching method is very easy

gajananandurkar
Автор

If we have to use only the largest memory's variable, then why we are declaring the other variables, with small data types in Union? We can declare just one variable with maximum data type.

rohitthakur
Автор

bahut accha padhate ho sab samaj aa gya thank you

Harshit_patel
Автор

Tq Bro
Because of you I got good marks in RDBMS 🙂🙂🙂

pandayalachandrashekar
Автор

Well, you said that, to store a distance of “High Variability”, we use Union. But, in reality, you can simply use a double, for Decimal as well as Integer values, or unsigned double if you want more storage. That's not a problem, and that's not actually where it's used.
Union is strongly related to type punning (type-casting). If you want to read a variable of Type: A, as Type: B, (without copying) we can use either of following methods:
- *(B*)(&A)
- or, by using a union

Union is most commonly used in Polymorphism. Where, an Object can act as a Base (primitive) Object, or a Derived (primitive) Object. Like, reading integer as double, or reading float as long etc.
Edit: Corrected Wording

TheMR-
Автор

Sir C programming se direct Galaxy me chale gaye 🤣
But best explanation thank you Sir👌

vinushisoni
Автор

Sir Data structure & Algorithms Start
Make videos...🙏for competitive programing...✅🇮🇳

rajanmodanwal
Автор

Sir... Please make video for python...
And your computer network and AI tutorial videos is superb 👍🏻

dikshakumari
Автор

sir which software you used in which you used white board

shahrozkidunia
Автор

Sir, ""System Analysis and Design(SAD)"" subject bhi padayo

hirenmeghnani
Автор

Which of the following terms is just the collection of network that can be joined together ? Sir Iska answer kya h plzbata dijiye internet intranet extranet ...me kya ans sahi he...sab jagah different de rakha h

priyankashukla
Автор

Instead of writing g so many variable in union why can't we just take "double data type" to define the size? What is the reason behind taking all the data type and the size of the biggest data type get's the priority!?

souvikmajumdar
Автор

best sir c programming ke or bhi video banana plz

mr.rameshbhaiapatelfitter
Автор

Hello varun sir ..I want to learn python from you .plz tell me how is it possible??

nidhisharma
Автор

sir machine learning pe bhi bnai hai aapne video

__Uv
Автор

Sir one request please compiler playlist me runtime environment topic pe bhi ek vedio bana dijiye ....

jyotiyadav
visit shbcf.ru