6.3 Local variables

주홍영·2022년 3월 12일
0

Learncpp.com

목록 보기
62/199

https://www.learncpp.com/cpp-tutorial/local-variables/

이번 내용은 local variable의
duration lifetime에 관한 내용으로 생략한다

Quiz

Q2 What’s the difference between a variable’s scope, duration, and lifetime? By default, what kind of scope and duration do local variables have (and what do those mean)?

A variable’s scope determines where the variable is accessible. Duration defines the rules that govern when a variable is created and destroyed. A variable’s lifetime is the actual time between its creation and destruction.
Local variables have block scope, which means they can be accessed inside the block in which they are defined.
Local variables have automatic duration, which means they are created at the point of definition, and destroyed at the end of the block in which they are defined.

profile
청룡동거주민

0개의 댓글