Is there memory area called 'stack' in C++ to store automatic variables

前端 未结 5 461
抹茶落季
抹茶落季 2020-12-16 01:01

Is there a specific area in memory called stack in C++ where automatic variables are getting stored.

5条回答
  •  再見小時候
    2020-12-16 01:57

    Vague question, but yes. A program's stack in C++ typically starts high in the virtual address space of the program and moves 'down' towards the virtual address space of the program heap.

    EDIT:

    Because I have started a controversy in saying yes to this, I will append to the answer. The C++ standard does not call specifically for a stack to be used to implement local storage. It is, however, a common implementation practice to do so as described above.

提交回复
热议问题