At what point does the language require the compiler to store a local static variable into memory? Is it at compile time? Or at runtime when the function that contains the local static variable is called?
int* GetMyVariable()
{
static int A = 50;
return &A;
}
I want to be able to only use memory for 'A' if GetMyVariable() is called. If static doesn't work like this, then is a dynamic allocation my only option? Thanks for your time.