c - When are static function variables allocated? -


i have question in allocation of memory static variables. please @ following snippet.

#include<stdio.h> #include<conio.h>  void fun();  static int a;  void main() {     fun();     getch(); }  void fun() {     static int b; } 

can please explain me when memory allocated static int b in function fun (before main executed or when function located). knew memory static allocated once, want knew when memory allocated it. please explain.

i using 64 bit processor, turbo c compiler, windows 7 operating system.

memory static variables allocated when program loaded. static variables in function initialized before function called first time.


Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -