69 - DIFFERENCE BETWEEN STRUCTURE & UNION - C PROGRAMMING

แชร์
ฝัง
  • เผยแพร่เมื่อ 5 พ.ย. 2017
  • Difference between union and structure is in memory allocated to the variable.
    For structure variable the memory allocated is the sum of sizes of all the members of a structure.
    For Union variable the memory allocated is the highest size of the member of a union.

ความคิดเห็น • 68

  • @irukoticherishma1751
    @irukoticherishma1751 3 ปีที่แล้ว +3

    Excellent explaination sir ...👏👏

  • @kalyanachakravarthi2736
    @kalyanachakravarthi2736 3 ปีที่แล้ว +3

    Sir in the example which you gave for unions, will the union can only save one element at a time or can it save both the elements?

  • @madhamanish8959
    @madhamanish8959 3 ปีที่แล้ว +2

    Thank you so much sir .. Cleared my confusion

  • @bidyutkrdas54
    @bidyutkrdas54 5 ปีที่แล้ว +2

    Sir,what happens if we declare the float first in union and then int ?will the output somehow change?

  • @abdulfareed2585
    @abdulfareed2585 5 ปีที่แล้ว +3

    Great explained 😍

  • @drnnarayana5027
    @drnnarayana5027 5 ปีที่แล้ว +7

    Explained it with a great conceptual clarity sir.

  • @tejeswarv450
    @tejeswarv450 5 ปีที่แล้ว

    Awesome explanation

  • @naurinsultana1166
    @naurinsultana1166 3 ปีที่แล้ว +2

    You r the best sir

  • @dharma3404
    @dharma3404 5 ปีที่แล้ว +1

    Sir in the previous video about structures u said that if we give a tag name to the structure we have declare structure variable in the main function but in this program why u have declared before main function but u have given tag name student does it matter or not please explain sir?

  • @siddhu-Janasena
    @siddhu-Janasena 3 ปีที่แล้ว +1

    Nice explanation 👌

  • @vimalareddy5957
    @vimalareddy5957 5 ปีที่แล้ว +1

    Sir for union the output will print only the higher value?

  • @vidyapaygude8650
    @vidyapaygude8650 5 หลายเดือนก่อน

    Thnks, so far clear and easiest explanation

  • @girishkumar9550
    @girishkumar9550 5 ปีที่แล้ว +2

    tell me in which type of condition where union can be use. and why use union. why not structure

  • @anindasen3818
    @anindasen3818 2 ปีที่แล้ว

    very nicely explained.

  • @zoteasailofs1526
    @zoteasailofs1526 5 ปีที่แล้ว

    Thankyouuu

  • @anithat9275
    @anithat9275 5 ปีที่แล้ว +1

    Sir I need the difference between static memory and dynamic allocation can you send the link

  • @harshnarai8627
    @harshnarai8627 4 ปีที่แล้ว

    Thanku sir very briefly explained

  • @SatishNaidu_143
    @SatishNaidu_143 5 ปีที่แล้ว +2

    Sir we want clarifies structure, function, pointer, files chapter some clarification in that programme not understand if you want to explain

  • @anatomic_anime
    @anatomic_anime 5 หลายเดือนก่อน +1

    Thankyou sir ❤

  • @dudekulachandbasha9959
    @dudekulachandbasha9959 5 ปีที่แล้ว

    By u r lecturer I will get good marks sir conform pakka

  • @iniyaviji2796
    @iniyaviji2796 ปีที่แล้ว

    Clear explaination thank u sir

  • @dudekulachandbasha9959
    @dudekulachandbasha9959 5 ปีที่แล้ว

    No douts sir very t q sir

  • @kp7677
    @kp7677 3 ปีที่แล้ว +1

    Very simple He made understand

  • @harshith_takkala
    @harshith_takkala 4 ปีที่แล้ว

    sir for float it is coming 0.0000
    what should i do

  • @srisaiadithiya1318
    @srisaiadithiya1318 ปีที่แล้ว

    Thank you very much sir

  • @ANGamer990
    @ANGamer990 6 หลายเดือนก่อน

    Thanks

  • @palakurpushpa9241
    @palakurpushpa9241 5 ปีที่แล้ว

    Tq sir

  • @poojithaganduri4093
    @poojithaganduri4093 2 ปีที่แล้ว

    Tq

  • @m.vijayaraghavendra9364
    @m.vijayaraghavendra9364 3 ปีที่แล้ว

    How to use unions to arrays

  • @kushal8385
    @kushal8385 3 ปีที่แล้ว

    That was good u deserve a like and subscribe!!

  • @praneethReddyGangidi
    @praneethReddyGangidi 6 ปีที่แล้ว +4

    Sir if both data types have same size then how the memory is allocated and what will be the output

    • @sundeepsaradhi
      @sundeepsaradhi  6 ปีที่แล้ว +10

      hi Praneeth
      if both the members are of same data type like
      struct
      {
      int a;
      int b;
      }s1;
      Here S1 is structure variable with two members with integer data type so Memory allocated for S1 is 4 Bytes.
      union
      {
      int a;
      int b;
      }s1;
      Here S1 is union variable with two members with integer data type so Memory allocated for S1 is 2 Bytes and the same 2 Bytes will be shared by both the union members.
      Hope your doubt has been clarified.

    • @ashutoshsahoo1870
      @ashutoshsahoo1870 5 ปีที่แล้ว +3

      it will take one of them

  • @jatrothgopal
    @jatrothgopal 3 ปีที่แล้ว +1

    Good sir

  • @kommirihemalatha2686
    @kommirihemalatha2686 ปีที่แล้ว

    Then what is the use of union sir

  • @githiontutorial3861
    @githiontutorial3861 4 ปีที่แล้ว

    Super sir

  • @jibu9336
    @jibu9336 ปีที่แล้ว

    super sir

  • @base2base217
    @base2base217 5 ปีที่แล้ว

    In the union program I get as output the first member of the union variable s1, and not the highest is shared, i.e rno = 20 perc = 0.00000
    May I have an answer?

  • @Strafkolonie
    @Strafkolonie 6 ปีที่แล้ว +1

    So are unions used to save memory ?

  • @puneethhb7905
    @puneethhb7905 2 ปีที่แล้ว

    Sir how to a declare function

  • @faizanhabib4585
    @faizanhabib4585 3 ปีที่แล้ว

    Nice

  • @Hmkm522
    @Hmkm522 6 ปีที่แล้ว +1

    thank u sir

    • @sundeepsaradhi
      @sundeepsaradhi  6 ปีที่แล้ว

      hi manoj
      i would like to have a FEEDBACK ( in the form of video not more than 15 sec) from you towards our channel and my sessions.so that i will collect feedbacks from all and will upload in youtube,
      Send your valuable FEEDBACK to my WhatsApp number : +91 9885466061 (91 is the country code)
      waiting for your valuable feedback.
      th-cam.com/users/sundeepsaradhi
      SO MAKE A VIDEO WITH FEEDBACK ON OUR CHANNEL AND SEND AS SOON AS POSSIBLE.

  • @k.s.saideepak5240
    @k.s.saideepak5240 5 ปีที่แล้ว

    Sir ,then how to print rno value in union ?

    • @GodNinja.69
      @GodNinja.69 3 ปีที่แล้ว

      Just dont print tha percentage

  • @varevatalkies4853
    @varevatalkies4853 6 ปีที่แล้ว +2

    Sir, please upload videos on files, type definition ,dynamic memory location ,preprocessor directives,sir, please.....

    • @sundeepsaradhi
      @sundeepsaradhi  6 ปีที่แล้ว +1

      hi vardini
      i would like to have a FEEDBACK ( in the form of video not more than 15 sec) from you towards our channel and my sessions.so that i will collect feedbacks from all and will upload in youtube,
      Send your valuable FEEDBACK to my WhatsApp number : +91 9885466061 (91 is the country code)
      waiting for your valuable feedback.
      th-cam.com/users/sundeepsaradhi
      SO MAKE A VIDEO WITH FEEDBACK ON OUR CHANNEL AND SEND AS SOON AS POSSIBLE.ask your friends to send their feedback.

    • @chiranjeevikumarbattula8709
      @chiranjeevikumarbattula8709 3 ปีที่แล้ว

      Yes sir

  • @Hmkm522
    @Hmkm522 6 ปีที่แล้ว +1

    sir about merge and quick sort pls explain sir

    • @sundeepsaradhi
      @sundeepsaradhi  6 ปีที่แล้ว

      HI manoj definitely i will upload them soon with in 2 or 3 days

  • @ashutoshsahoo1870
    @ashutoshsahoo1870 5 ปีที่แล้ว

    sir, I'm geting worng out put
    #include
    union student{
    int roll;
    float mark;
    }s1 = {10, 99.9};
    main()
    {
    printf("Values of S1 : %d \t %f
    ", s1.roll, s1.mark);
    }
    output :
    Values of S1 : 10 0.000000

  • @Mysteryp7
    @Mysteryp7 5 ปีที่แล้ว +1

    hi isnt int 4 byte?

  • @sarambakrishnancp9475
    @sarambakrishnancp9475 2 ปีที่แล้ว

    Ok bie

  • @manikantaswamysirivella7531
    @manikantaswamysirivella7531 3 ปีที่แล้ว

    Tell use of union

  • @surya_Narayana-bc2wd
    @surya_Narayana-bc2wd 5 ปีที่แล้ว

    I requested sir

  • @shantanunayek3072
    @shantanunayek3072 4 ปีที่แล้ว

    Sir suppose we have char and int datatypes under union...
    Now we store 10 into int and print%c, char...
    What output we will get?
    Does it gives 10?

  • @adss5095
    @adss5095 2 ปีที่แล้ว

    This is why i hate byjus 😁

  • @sivakrishna4502
    @sivakrishna4502 6 ปีที่แล้ว +1

    super sir

    • @sundeepsaradhi
      @sundeepsaradhi  6 ปีที่แล้ว

      hi shiva
      thanks for your interest towards our channel.