C Programming Tutorial 1 : Memory Layout of a C / C++ Program : Think Aloud Academy

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

КОМЕНТАРІ • 59

  • @syedzulfiqar9231
    @syedzulfiqar9231 11 років тому +7

    good, Few points to add
    1. a.out (the executable) has not just the text but also data segments (initialised) and bss (uninitialised) sections
    2. argc and argv should be in the same stack frame of main as these are arguments to it.
    3. stack and heap don't merge into one another as the OS ensures they don't cross the thresholds.

  • @MalleshamKarreShepherd
    @MalleshamKarreShepherd 3 роки тому +3

    Very excellent explanation with animation. Thanks a lot.

  • @WxsOnline
    @WxsOnline 10 років тому +9

    The stack is a constant size pre-allocated with something along the lines of 1MB. It appears BEFORE the heap in memory, not after it, and the heap can grow as needed (which should be upwards in the diagram) as more memory is allocated. The stack cannot grow, but rather the pointer into where to push/pop values to/from the stack changes as you traverse function calls. If the stack size is exceeded (e.g. 1 MB is used) then the program will crash due to a stack overflow.

  • @eweeparker
    @eweeparker 11 років тому +9

    Best memory visualization I have seen on youtube :)

  • @danielkrajnik3817
    @danielkrajnik3817 3 роки тому +1

    love those funky transitions

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

    Very good and funny videos bring a great sense of entertainment!

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

    U beautifully explained each one... What I feel missed here is.. the parameters and arguments.. If you can reply me.. Then please comment out answer for the above one... Thanks for your efforts.. Keep going bro!

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

    because of the animation it understand good, also explanation is good

  • @Xpingwinz
    @Xpingwinz 9 років тому +2

    Really liked the video; very informative, thanks!!

  • @al-ansarmohammed3480
    @al-ansarmohammed3480 2 роки тому

    amazing video!

  • @mohammedabulsoud517
    @mohammedabulsoud517 10 років тому +1

    Thank you . best one i have watched

  • @zedoo5699
    @zedoo5699 5 років тому +1

    Thanks, what about environment variables?

  • @911aggie
    @911aggie 12 років тому +1

    Thank you for posting this. Great video!

  • @MartinoNikolovski
    @MartinoNikolovski 8 років тому

    Awesome demonstration!

  • @chendrashekarpabbaraju7642
    @chendrashekarpabbaraju7642 3 роки тому

    Can you explain the same by taking structure as example

  • @narendrarana5552
    @narendrarana5552 4 роки тому

    The explanation is awesome indeed, but i have a query. As you have mentioned global initialized and uninitialized variable will get memory at respective area before runtime, and at runtime only stack is being created and after that only local variables get memory allocation in stack. My query is before runtime or before main program gets memory in stack, where these local variable are stored or in other way where from these local variable get pushed to this stack segment.

    • @RahulSoni-br1qd
      @RahulSoni-br1qd Рік тому

      Because the compiler starts the process from the main func itself , so there is no variable which is initialized or stored before run time .

  • @aaloobukhara1002
    @aaloobukhara1002 8 років тому +1

    Excellent way to demonstrate this memory layout.... very nice good job :)

  • @pedrosalzedo215
    @pedrosalzedo215 9 років тому

    Excellent Video!!

  • @mukeshsmart17
    @mukeshsmart17 11 років тому

    awesome explanation via animation

  • @mon_mat
    @mon_mat 4 роки тому

    Thank you very much.

  • @mukeshsmart17
    @mukeshsmart17 11 років тому

    thanks for posting Amit sir

  • @amit1234007
    @amit1234007 4 роки тому

    whe re the constant and volatile variable will be stored ?

  • @kapil6288
    @kapil6288 11 років тому

    ultimate sir awaesome vid i ve ever seen

  • @johncarlo4028
    @johncarlo4028 3 роки тому

    Sir you forgot to return a value to a func(). But I kinda understand how it works now. Ty

  • @SparkleWaterfly
    @SparkleWaterfly 10 років тому

    Really helpful...thanks so much

  • @rahullodhi161
    @rahullodhi161 5 років тому

    thank u , u made my day

  • @kamyasuraj131
    @kamyasuraj131 8 років тому

    Nice article!

  • @mizel_1121
    @mizel_1121 3 роки тому

    thank you bro

  • @cscor
    @cscor 9 років тому

    superliked this video cleared all doubts and confusion...

  • @narendrapanchal9542
    @narendrapanchal9542 3 роки тому

    Where does functions get stored in memory ?

  • @shmuthu
    @shmuthu 11 років тому

    Good one..

  • @Vishnubanavath
    @Vishnubanavath 11 років тому

    Some basic questions
    1) who will create all these sections
    2) what is the use of uninitialized Variables segment (.bss)
    3) where is static uninitialized local variables stored.

    • @bablumomin168
      @bablumomin168 7 років тому

      ans.1)execution of c program is one of process known to OS (Operating System) so process demand for this doing section service to OS then OS will call to something call 'System call' which actually do this section ....System call is nothing but a predefined function or program of OS .....
      2) kernel (heart of OS) initialized uninitialized variable to zero ....so kernel do this for variable which are in this section
      3) if static variable uninitialized or initialized to zero then it is in uninitialized variable section (uninitialized data segment ) ....and if initialized with some value other then zero then in initialized variable section((initialized data segment ))

  • @NabilMagdy
    @NabilMagdy 7 років тому

    Many Thanks Brother :)

  • @divyas7516
    @divyas7516 4 роки тому

    What do we call as "Memory here" is it the RAM

  • @GokulKarthickregency
    @GokulKarthickregency 10 років тому

    thank u very much sir....

  • @0youwannagethigh0
    @0youwannagethigh0 9 років тому

    Thanks man, that was actually pretty helpfull !

  • @raghugolla3658
    @raghugolla3658 9 років тому

    thanks man..............

  • @bicepjai
    @bicepjai 11 років тому

    gud one !

  • @erbkgupta8679
    @erbkgupta8679 8 років тому

    thank you sir... :-)

  • @chborger185
    @chborger185 3 роки тому

    C on a DEBUG lowbudget ASICS or anything ELSE what is a OPERATIONsystem means GUI - terminal TTY

  • @nate3010
    @nate3010 9 років тому

    Very cool!! (;

  • @SearchingPeaceInside
    @SearchingPeaceInside 10 років тому +12

    Sorry to say, This Presenter is providing WRONG INFORMATION.
    Mr amitkeerti have you ever thought how, a program only outputs a.out, And If it sits completely in Code(text) segment then how other segments gets information. I don't think complier stores information each program at it's End.
    a.out exe has complete information, it does not sits in Text(code Segment).
    What the Correct thing is this:
    When we compile a program, a.out is created which has following segments(a.out has segments)
    1. .text segment: Stores machine executable code of program (THIS GOES TO TEXT SEGMENT)
    2. .rodata: Stores ReadOnly(RO) data, format string, printf, jump to switch
    3. .data: Init global variables(THESE GOES TO DATA SEGMENT)
    4. .bss: Unit global variables (THESE GOES TO DATA SEGMENT)
    5. .symtab : (symbol table)
    6. .reltext: location of text sections which needed to be combined with other .obj files
    7. .reldata: Relocation information of global variables
    8. .debug: Debugging information for variables, globals, typedef, when compiler is given -g option.
    9. line: mapping between line number of C code and machine code
    10. .strtab: String table for debug and symbol table.
    Thanks

    • @RastaJediX
      @RastaJediX 8 років тому +1

      What? The instructions (that are to be executed) for a program are stored in the .text section. So every operation and function call etc. exists in .text, and the variables it refers to are stored in .data etc. The compiler places things where they belong, and the instructions in the .text segment refer to addresses of the .data etc. segments. I believe.

    • @NaveenKumar-nx8yi
      @NaveenKumar-nx8yi 3 роки тому

      Nice information. sir please recommend a book or website where I can read to these things related to memory layout of C program.

  • @vinayguptalkg
    @vinayguptalkg 7 років тому +1

    where static variables resides ?

    • @bablumomin168
      @bablumomin168 7 років тому

      if static variable uninitialized or initialized to zero then it is in uninitialized variable section (uninitialized data segment ) ....and if initialized with some value other then zero then in initialized variable section((initialized data segment ))

  • @prajwalwaingankar3636
    @prajwalwaingankar3636 7 років тому

    can any1 tell me what exactly data the HEAP segment contains ???? I knew that STACK contains all the FUNCTION var.
    BUT then what does HEAP contains ????
    ***** NEED THE CORRECT ASNWER PLSSS *******
    ****** ANY PERSON WITH THE RIGHT INFORMATION PLSS HELP ME ********

  • @cherifaly6757
    @cherifaly6757 6 років тому

    Foggoty stuff..

  • @bablumomin168
    @bablumomin168 7 років тому

    thank u very much sir..'