What & How & Why

差别

这里会显示出您选择的修订版和当前版本之间的差别。

到此差别页面的链接

两侧同时换到之前的修订记录前一修订版
cs:programming:cpp:cpp_primer:answers:chpt_6 [2024/01/14 13:46] – ↷ 页面programming:cpp:cpp_primer:answers:chpt_6被移动至cs:programming:cpp:cpp_primer:answers:chpt_6 codingharecs:programming:cpp:cpp_primer:answers:chpt_6 [2024/03/08 05:59] (当前版本) – [ex.6.6] codinghare
行 91: 行 91:
 ==ex.6.6== ==ex.6.6==
 >Exercise 6.6: Explain the differences between a parameter, a local variable, and a local static variable. Give an example of a function in which each might be useful. >Exercise 6.6: Explain the differences between a parameter, a local variable, and a local static variable. Give an example of a function in which each might be useful.
 +
   * Local Variable: A local variable is initialized by an argument or a initializer that is created inside a function. It will be destroyed when a function block ends.   * Local Variable: A local variable is initialized by an argument or a initializer that is created inside a function. It will be destroyed when a function block ends.
   * Parameter: A parameter is a local variable that is initialized by an argument.   * Parameter: A parameter is a local variable that is initialized by an argument.