08-31-2015, 10:29 PM
|
#10
|
Under the scarlet moon
Join Date: Jan 2014
Age: 31
Posts: 921
|
Re: [University - C++ Programming] Help With Assignment (Very Basic Stuff)
A non-static variable is (ignoring compiler optimizations) always allocated (including calling it's constructor which may be a costy operation for some types) and deallocated from stack memory during the duration of its scope. e.g. everytime the function where it is declared is called.
Compare to a static variable where the variable, simply put, 'stays there' through the lifetime of the process after its first use.
|
|
|