what's the scope of a static variable inside a local function?

Marc jckj33 at gmail.com
Fri Jan 5 21:44:48 UTC 2018


> void foo() {
> 	void baa() {
> 		static int n;
> 		writeln(n++);
> 	}
> }

> void main() {
>  static int x;
>  foo();
>  doSomething(x);
> }

does x and n has same lifetime, i.e, program's execution or n is 
longer available onde foo() call reach out of scope?



More information about the Digitalmars-d-learn mailing list