Can someone explain me one thing, why do you put static variables in the main function of the program. For example, in Petzold's "Programming Windows", he has
Why does he make szAppName static if WinMain is only called once? Another question is - why only szAppName is declared static but not the rest of the variables? I just dont see the reason to make variables static in main function.Code:WinMain(...) { static TCHAR szAppName[] = TEXT("HelloWin"); HWND hWnd; MSG msg; WNDCLASS wndClass; ... }