How to declare global variable inside function?

Viewed 63639

I have problem creating global variable inside function, this is simple example:

int main{
   int global_variable;  //how to make that
}

This is exactly what I want to do:

int global_variable;
int main{
                   // but I wish to initialize global variable in main function
}
4 Answers

well... its indirectly possible by declaring pointers global, and later assigning local variables to them, but sometimes it may lead to situations where pointed variable is unaccessible .

Related