About C/C++ stack allocation

前端 未结 7 682
一个人的身影
一个人的身影 2020-12-15 12:44

While studying C++ (and C) I had some particular doubts regarding the working of stack allocation, that I can\'t find a solution to:

  1. Does stack allocation c

7条回答
  •  [愿得一人]
    2020-12-15 13:33

    No, stack allocation does not call malloc/free. The entire stack space is allocated at the start of your program. On entry to each function the stack pointer is advanced sufficiently to allow space on the stack for a "stack frame" which will be where your stack allocated variables reside.

提交回复
热议问题