Union in C programming | Structure vs Union

Поділитися
Вставка
  • Опубліковано 6 кві 2022
  • 👉Subscribe to our new channel: / @varunainashots
    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):
    • C Programming
    Other subject-wise playlist Links:
    --------------------------------------------------------------------------------------------------------------------------------------
    ►Design and Analysis of algorithms (DAA):
    • Design and Analysis of...
    ►Database Management System:
    • DBMS (Database Managem...
    ► Theory of Computation
    • TOC(Theory of Computat...
    ►Artificial Intelligence:
    • Artificial Intelligenc...
    ►Computer Networks (Complete Playlist):
    • Computer Networks (Com...
    ►Operating System:
    • Operating System (Comp...
    ►Structured Query Language (SQL):
    • Structured Query Langu...
    ►Discrete Mathematics:
    • Discrete Mathematics
    ►Compiler Design:
    • Compiler Design (Compl...
    ►Number System:
    • Number system
    ►Cloud Computing & BIG Data:
    • Cloud Computing & BIG ...
    ►Software Engineering:
    • Software Engineering
    ►Data Structure:
    • Data Structure
    ►Computer Architecture :
    • Computer Organization ...
    ►Graph Theory (Complete Playlist):
    • Graph Theory
    ►Digital Logic:
    • Digital Logic (Complet...
    ---------------------------------------------------------------------------------------------------------------------------------------
    Our social media Links:
    ► Subscribe to us on UA-cam: / gatesmashers
    ►Subscribe to our new channel: / @varunainashots
    ► Like our page on Facebook: / gatesmashers
    ► Follow us on Instagram: / gate.smashers
    ► Follow us on Instagram: / varunainashots
    ► Follow us on Telegram: t.me/gatesmashersofficial
    ► Follow us on Threads: www.threads.net/@gate.smashers
    --------------------------------------------------------------------------------------------------------------------------------------
    ►For Any Query, Suggestion or notes contribution:
    Email us at: gatesmashers2018@gmail.com

КОМЕНТАРІ • 70

  • @anjalimeena3006
    @anjalimeena3006 Рік тому +60

    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 :)

  • @poojapoojadhapte1430
    @poojapoojadhapte1430 Рік тому +9

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

  • @rupesh_gamer
    @rupesh_gamer Рік тому +4

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

  • @komalchaudhary3424
    @komalchaudhary3424 Рік тому +1

    Thank you sir ✨

  • @binusahu95
    @binusahu95 7 місяців тому

    Thank you so much sir helpful topic

  • @gajananandurkar3445
    @gajananandurkar3445 Рік тому

    Thanks sir your teaching method is very easy

  • @sushildwivedi4289
    @sushildwivedi4289 5 місяців тому +1

    Thankyou sir

  • @amaanalikhan9450
    @amaanalikhan9450 Рік тому

    UA-cam is a very nice platform ☺

  • @kyakrogejaank4137
    @kyakrogejaank4137 2 місяці тому

    Thank you sir

  • @rohitthakur6397
    @rohitthakur6397 Рік тому +9

    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.

  • @Harshit_patel513
    @Harshit_patel513 Місяць тому

    bahut accha padhate ho sab samaj aa gya thank you

  • @shahrozkidunia3685
    @shahrozkidunia3685 11 місяців тому

    sir which software you used in which you used white board

  • @pandayalachandrashekar4678
    @pandayalachandrashekar4678 2 роки тому +4

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

  • @Imrankhan8bp
    @Imrankhan8bp 9 місяців тому

    Nice sir

  • @Tamanna_K_Hardy
    @Tamanna_K_Hardy 2 роки тому +9

    Great as Always 😎

  • @Piyush_sahu.1
    @Piyush_sahu.1 6 місяців тому +3

    Watching 2hr before exam

  • @amaanalikhan9450
    @amaanalikhan9450 Рік тому +2

    Thanks sir its goes in my syllabus.

  • @aditinageshwar3217
    @aditinageshwar3217 Рік тому +1

    Thanks a lot sir😊

  • @user-zv7kj6ht8u
    @user-zv7kj6ht8u 7 місяців тому

    ❤❤

  • @amitgoswami7856
    @amitgoswami7856 2 роки тому

    Great explain sir

  • @rajanmodanwal7479
    @rajanmodanwal7479 2 роки тому +2

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

  • @harish9490
    @harish9490 2 роки тому

    Superb sir

  • @Ravina-gl4od
    @Ravina-gl4od 10 місяців тому

    Tq sir

  • @lalianschool6806
    @lalianschool6806 2 роки тому

    khush rahin sir !

  • @TheMR-777
    @TheMR-777 2 роки тому +3

    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

  • @swatiyadav3993
    @swatiyadav3993 2 роки тому

    nice explanation

  • @sscode3809
    @sscode3809 2 роки тому

    Wah sir you are great

  • @mohammediuzrakhanum91
    @mohammediuzrakhanum91 Рік тому

    What about nested structure

  • @hirenmeghnani
    @hirenmeghnani 2 роки тому +1

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

  • @milindthakare1648
    @milindthakare1648 Рік тому +1

    you look like bgmi punk

  • @kallugaming1k
    @kallugaming1k Рік тому

    Osam padh ho bhaiya g

  • @nidhisharma6539
    @nidhisharma6539 2 роки тому

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

  • @vinushisoni4773
    @vinushisoni4773 Рік тому +3

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

  • @priyankashukla9945
    @priyankashukla9945 2 роки тому

    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

  • @mr.rameshbhaiapatelfitter2299
    @mr.rameshbhaiapatelfitter2299 2 роки тому

    best sir c programming ke or bhi video banana plz

  • @sarastemkar7835
    @sarastemkar7835 Рік тому

    baked bun

  • @dikshakumari382
    @dikshakumari382 2 роки тому +2

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

  • @souvikmajumdar9090
    @souvikmajumdar9090 Рік тому +1

    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!?

  • @DhruvKumar-dikito
    @DhruvKumar-dikito 11 місяців тому

    ex peecha hi nahi chodti. Padhne aya tha idhar bhi aa gai

  • @prathasaxena9474
    @prathasaxena9474 2 роки тому

    Wow! sir😍😍
    Simply awesome......🙏

  • @chikkii1601
    @chikkii1601 2 роки тому +2

    First comment 🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳🥳
    Thank you for the video Varun sir 🥳🥳🥳🥳🥳🥳🥳

  • @Eclipso619
    @Eclipso619 2 роки тому +4

    🤟🎯🤟

  • @__Uv09
    @__Uv09 2 роки тому

    sir machine learning pe bhi bnai hai aapne video

  • @shivam2246
    @shivam2246 2 роки тому

    Sir please rajasthan computer instructor ki test series launch kro chapter wise questions k saath bohot jaada dimand hai

  • @asutoshdoppalapudi7830
    @asutoshdoppalapudi7830 2 роки тому

    make videos on machine learning also

  • @muhammadafzal8329
    @muhammadafzal8329 2 роки тому

    Sir AI ka complete syllabus krwa do

  • @__Uv09
    @__Uv09 2 роки тому

    machine learning iss bar course me sir

  • @user-hf4be1ty2s
    @user-hf4be1ty2s 6 місяців тому

    You are getting hurry in every topic you need to work on some complicated problem sir

  • @sachinmaurya4869
    @sachinmaurya4869 4 місяці тому +1

    Very bad video 👺👺👺👺👺👺👺👺👺👺👺👺

  • @a2thegenius343
    @a2thegenius343 2 роки тому +3

    Channel band kar do
    Bahut bekar padhate ho

  • @LORDSMOBILE108
    @LORDSMOBILE108 Місяць тому

    Thankyou sir

  • @jyotiyadav3153
    @jyotiyadav3153 2 роки тому

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