View Single Post
Old 08-31-2015, 10:29 PM   #10
AutotelicBrown
Under the scarlet moon
FFR Simfile AuthorD7 Elite KeysmasherFFR Veteran
 
AutotelicBrown's Avatar
 
Join Date: Jan 2014
Age: 31
Posts: 921
Default 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.
AutotelicBrown is offline   Reply With Quote