Each time we call the function, the stack of activation records (usually just called the stack) grows with one record. Conversely, when the function returns, its record is no longer used and so on. The stack (also called the call stack) is a data structure that grows and shrinks at one end according to the rule first in and first out.
最后一行是否正确?我在 Bjarne Stroustrup 的《使用 C++ 的编程原理和实践》一书中读到了它。
最佳答案
这是一个错误。堆栈是,根据定义 , 后进先出 (LIFO)。先进先出 (FIFO) 数据结构将是一个队列,而不是一个堆栈。
关于c++ - 调用堆栈是否在 C++ 中先入/先出?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65193521/