gpt4 book ai didi

c++ - 调用堆栈是否在 C++ 中先入/先出?

转载 作者:行者123 更新时间:2023-12-03 10:05:09 25 4
gpt4 key购买 nike

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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com