C_116 Structure Padding in C | C Language Tutorials

Поділитися
Вставка
  • Опубліковано 5 лис 2024

КОМЕНТАРІ • 124

  • @saibalam7852
    @saibalam7852 2 роки тому +70

    If there is no Jenny's lectures I definitely quit from CS DEPARTMENT BUT NOW I can't quit from this because I ❤️ MY CS DEPT BECAUSE OF JENNY MAM MY BEST CODING GURU TQ SO MUCH MAM

  • @pranavsood2767
    @pranavsood2767 2 роки тому +19

    don't focus your attention on the negative comments mam, coz it's just a distraction. Most of your fan base love your work and are grateful for you to do this here.

  • @suryaganeshpindiprolu472
    @suryaganeshpindiprolu472 2 роки тому +13

    Teaching everything you have for free is really appreciable. Can you please make a video on your coding journey and how you got into youtube . Thank you again 😄.

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

    Mam, you are a blessing to us, your lectures helped me in my exam, and i got A+ in C programming. It is not about the grade, but the understanding, you are making me understand C, and this is good for me as a beginner. Thanks mam.

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

    Awesome It just clear the concept

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

    amazing ma'am, thank you sooooooooooo muchhhhh for teaching such deep topics.

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

    *WHY IT WILL NOT TAKE 2 CYCLES?* - in the total 8 bytes of memory stack, if total 5 bytes are required for 2 variables (1 int + 1 char) then to process 5 bytes from any location, 2 times the memory has to be accessed if the system can access only 4 bytes at one time. So how does it make sense to use 1 bytes first and 4 bytes at last of the memory stack?

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

    Hi Jenny ,you have prepared very well and do lecture in a elegant and detailed explanation.I like your way of teaching .Thanks sister

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

    Well explained thank you madam

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

    mam there is no teacher like you. your teaching style make me big fan of you love from heart..❣❣

  • @VIJAYPARMAR-ot4hw
    @VIJAYPARMAR-ot4hw 2 роки тому +1

    Jayanti mam I love u your teaching habit

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

    Thank you so much Jenny mam

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

    Increasing or decreasing order

  • @kanupriyasharma8741
    @kanupriyasharma8741 10 місяців тому +1

    is structure padding only for structures or all codes(in void main int a ,char etc)?

  • @मिठाईलालयादव-ङ1ह

    Mam I'm currently doing job
    But now I have decided I wil study and try to understand u

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

    Love you mam 😘😘

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

    I'm from Mars, your videos helped me a lot :D
    Well jokes apart, you're helping hundreds and thousands one night before ecams. Thanks lot

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

    From ANDHARA PRADESH 💞🥰

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

    I m following this playlist... I hope I get here soon 😅😅

  • @riyagupta1841
    @riyagupta1841 2 роки тому +5

    Mam after structure packing pls cover enum, malloc, calloc, realloc !
    Don't forget to cover these topics mam pls 🥺😕
    You have also replied on my comment "Okie" so pls don't forget to cover these topics mam please pls 🙏😄

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

    instead of increasing decreasing will more reduce size e.g - int a,char b then 4 byte will take at 0 to 3 and char will place at 4 so total will be 5 where in increasing it is 6

    • @Ebookstore..
      @Ebookstore.. 6 місяців тому

      had the same doubt..i do think so it ahould be decreasing order itself

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

    Hi Ma"am. Hope you will be doing Great.I am your biggest fan. I love the way you speak, the way you deliver the Lectures.
    We understand it Very Very.... Well. keep doing it . Thanx

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

    hello mam, Thankyou for give answer of what is padding beacause of this question asked in my interview and unfortunately i don't know then after i search on youtube/google and after this i found this video

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

    Thank you so much ❤

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

    if there is only char c in a structure, it should assign 4 byte of memory. but when executing it gives only 1 byte???

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

    thank you madam

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

    I really love your explanation.❤

  • @ADITYAKUMAR-mf4po
    @ADITYAKUMAR-mf4po 4 місяці тому

    class Example {
    char c;
    int i;
    short s;
    }; what will be the total size for this ?

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

    Hi mam I am from Pakistan ur teach style is very well

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

    awesome mam noone tell be about this concept

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

    One thing is missing, to reduce memory wastage one should always use packing rather than writing elements in increasing order of their size. CPU cycles does not matter.

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

    Third Like Mam.Love From Andhrapradesh..

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

    Mam your videos are very useful

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

    Please answer,
    #include
    Struct abc{
    Int a;
    Char b;
    Int c;
    }var;
    Void main() {
    Printf("%d bytes", sizeof(var));
    }
    Output : 12 bytes
    Whereas i am expecting the output to be "16 bytes" [4bytes(for a)+1bytes(for b)+3bytes(padding)+4bytes(for c)+4bytes(padding)] coz my system is of 64bit and word size has to be of 8bytes.

    • @CHINMAYAM-p9i
      @CHINMAYAM-p9i Рік тому

      nope for int 4 bytes and char has 1 byte remaining 3 are padding and other int has 4 bytes totally 12 bytes

  • @jony-s5m
    @jony-s5m 2 роки тому +1

    I am big fan mam

  • @Heisenberg-pr1hk
    @Heisenberg-pr1hk 2 роки тому +2

    I defined int,char,int in 64 byte computer. I expected sizeof this struct 16 byte but it was 12 byte. 4(int) + 1(char) + 3(blank) + 4(int) = 12byte. Why is it like this ? Shouldn't take also 4 byte ?

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

      I have also been asking the question but it is mostly ignored. What I found out from research is that compiler sometimes perform additional optimizations or the compiler settings may be affecting the structure behaviour, Compiler behavior can vary, so it's worth checking the documentation or specific compiler settings to understand the exact behavior in your case
      Often the structure will be aligned to the size of the largest member in the struct, so because the strict has int the max size of a member is 4 bytes and the struct is 4-bye aligned as a result. 🙂
      this was the situation in my case, I confirmed this by iincluding a long datatype and the size became 24 meaning the compiler made the byte-alignment according to the largest member of the struct, if not I should have gotten 20 instead for a 4-byte alignment,

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

    thanks maam

  • @Akash-gl6os
    @Akash-gl6os Рік тому

    Ma'am how many memory will be allocated for double and long ,i mean how many data cycles ?

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

    Mam please complete DBMS and DAA mam

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

    I proud of you 👏

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

    Mam explain structure and functions ,enumerated datatype

  • @CarlJohnson-bf8dq
    @CarlJohnson-bf8dq Рік тому

    if i take double with 2 char so how padding would done?

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

    Mam Plzzz Upload video of N Queen Problem by backtracking.........

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

    Good

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

    Ma'am please c++ ki series start karen....plzzz...aap bhut achha padhati h...muje aap se padhna h..

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

      ua-cam.com/video/dKVzZk4Pr2A/v-deo.html C++

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

    how padding reduce cpu cycle or increase speed as it will take 2 cycle for int and char , without padding it was taking 2 cycle so how it increase speed.

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

      yeah, I think she made a mistake because in both instances it would still take 2 cycles for a 4-byte word addressing, but at the end of the day I guess she explained the concept well and explained it properly when she used three members at 12:35 (char, int, char) for the structure

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

      @@monarchofaether actually she is right , i learnt after that many resources actually, if we only want to use either char or int without padding then cpu will process 1 cycle for 2 byte another cycle for remaining 2 byte int which is stored in anothee 8 byte address, but if you use padding then all byte of either int or char will be on one 8 byte address storage so if you only need to access int then it will run 1 cpu cycle. you can understand it as for accessing only one variable data type it is faster other wise we have to run unnecessary cycle

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

    Jenny please make a video about how to avoid padding most important question in interviews

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

    Mam also teach enum and file handling

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

    Thank you mam, but there is one correction... Don't blame you,just want to help people..
    There is little different theory...for padding
    Let's take example: struct { double , char}
    as per this logic on 64 bit machine, answer will be 8+1+3(padding)=12.
    But Padding happens of the highest data type, like in our case highest is 8 byte, so next it reads as same byte(if there is less it will pad), so
    8 + 1+7(padding)
    If there are more variables then too it will keep padding to make it 8byte...
    I don't blame Jenny but looks she missed something,btw she is doing the great job.

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

      Please do try
      {Double , int}
      {Int , char}
      {*p , char}
      {Long double, char}
      You will observe the results...
      I am not here to criticize anyone.. I started learning from Jenny mam,n I respect her.

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

    #Q Thank you for info. After structure padding may I know the process of data reading happen correct way.colud you please explain the process of read in unaligned and aligned structure?

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

    ma'am at 12:35 using the same datatype in structure members is an error said by you in previous videos...Kindly clarify my doubt why you have written the same data type. Thank you.

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

    Please do a class on dynamic memory allocation

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

    Can a 32byte processor also allocate 4-4-4- bytes memory? 🤔

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

    I am here just to say....😍😍

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

    Madam can you please give one lecture about DMA, storage classes in c .

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

    I have same size with structure padding and packing
    I have size of structure packing mam
    Solve issue

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

    Mam if we use float

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

    Structure s
    {
    Char *ptr;
    Char c;
    };
    Size of structure in 32bit compiler it's giving size as 16,
    Why not size is 12( 8 for pointer, 4 for char), it's word size is 4 right, so why not multiple of 4 size is not there

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

      There is little different theory...bro, I got to know today...
      Padding happens of the highest data type, like in your case highest is 8 byte, so next it reads as same byte, so
      8 + 1+7(padding)
      I don't blame Jenny but looks she missed something,btw she is doing the great job.

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

    Lecture Starts at 2:15

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

    Java, Android tutorial start Karo plzz

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

    7:32

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

    save memory save computer

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

    Nothing but respect for you. Thank you for makin all of our lives easier. Amazing work!

  • @Rajveersingh-ix9uy
    @Rajveersingh-ix9uy 2 роки тому

    mam nested structure nhi pdhaye hai please ak video bna degeye

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

    Mam your all c program is available in the chanal

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

    Mam how can we see it on a program

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

    Madam Please Teach About LAMBDAS in C .... and C ++ ... Please Mam....

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

      ua-cam.com/video/dKVzZk4Pr2A/v-deo.html C++

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

    Ma'am, Theory Of Automata py bhi Series baneaya Ga.Ma na boht search kia tha lekin boht moshkil .
    agar aap koi youtube channel ya notes etc share kardein.barii mehrobani hogi....thank you

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

      Love From Pakistan.

  • @abhaytiwary2981
    @abhaytiwary2981 4 місяці тому

    struct abc {
    char a;
    char b;
    }var;
    For 32 bit processor (4 bytes word size)
    sizeof(var) should be 4 bytes
    but, I am getting result 2 bytes on my laptop after running this program.
    If someone can answer, then please answer this.

    • @SamSam-ny9nf
      @SamSam-ny9nf 3 місяці тому

      Larger data type is 1byte. So it will take 2 bytes. Both are char.

    • @shashwatmangulkar1107
      @shashwatmangulkar1107 3 місяці тому

      sizeof() is the memory in bytes used from the allocated
      allocated is the separated memory for that paticular struct. so ig it's showing you the memory used by the struct abc

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

    My life is full of obstacles. (family,money and gf mrg proposal) mam... I am unable to understand everything. Help me mam please😫😫😫

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

    Maddam je , can you explain master detail relationship plz in hindi 🙏🙏🙏🙏🙏🙏

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

    ok we are done with DS now start C# and Kotlin

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

    struct zzz{
    int k;
    int c;
    char d;
    }n;
    why i am getting the size 12 ,instead of 16 in a 64 bit machine??

    • @CHINMAYAM-p9i
      @CHINMAYAM-p9i Рік тому +1

      nope for int 4 bytes and char has 1 byte remaining 3 are padding and other int has 4 bytes totally 12 bytes

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

    JAVA bhi sikhao na....pls

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

    superrrrbbbbbbbbbbb mam g

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

    ❤️❤️❤️❤️

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

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

    I love you 💖 mam appko dak ka fidda hogiya

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

    ❤❤❤❤❤

  • @jony-s5m
    @jony-s5m 2 роки тому +1

    And your subject

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

    mam . when will start oops concepts , it is very important for us , please tell me mam , I am waiting your reply , please please mam , I humbly request to you.

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

    Mam could you plz cover files in c mam please

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

    Very interesting. Could you please do the lectures on design patterns also?

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

    I love you ❣️ I like you 😍 I miss you 😘

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

    Нормально прогнала за выравнивание, но английский, конечно, очень смешной.

  • @shivpalchaudhary-rq4ed
    @shivpalchaudhary-rq4ed Рік тому +1

    You are so beautiful

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

    You are beautiful mam

  • @Music.Com.4
    @Music.Com.4 2 роки тому +1

    first view ma'am

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

    Mam app bohut sundor ho apki marriage hogiya ?

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

    I am failed in this question........ I'm watching it too late 😭😭

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

    Good evening ma'am Iam in class 9 .
    I see all your videos for information.

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

    Ma'am agar aap ye comment padh rahi hai to please btaye 🙂
    Programming sikhne ke liye English aana zaruri hai aur computer ka student hona zaruri h..

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

    Mam Aap hairs Open Krke padaya karo Jyada samajhta hai..🥰🥰🥰

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

    Excuse me ms, im from indonesia. if possible please include indonesian subtitle. Im not good at english.

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

    Love 💕 😘 you jennis, agar tum mil jao jamana chod denge ham

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

    Fidda fidda fidda

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

    Pls

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

    Hi mam iam the first who is watching your new video plz if u read my comment plz mention me

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

    take care jenny maam 🙂🙃😉

  • @4p1-saitejat83
    @4p1-saitejat83 2 роки тому +1

    Madam are u married or you have a boy friend
    Because so beautiful