Original Post
hey is it possible to create a global variable from inside a function??
~aussie
//1)
int* getGlobalInteger() {
static int globalInteger;
return &globalInteger
}
//2)
void someFunction() {
static int globalInteger;
static bool firstTimeThrough = true;
if(firstTimeThrough) {
tellSomeOtherFunctionAboutThisGlobal(&globalInteger);
firstTimeThrough = false;
}
}
int test() {
static int x = 0;
return ++x;
}
This topic has been locked by a moderator. New replies are not allowed.
With your permission, GameDev.net uses analytics cookies to understand how people use the platform. You can accept analytics or continue with necessary cookies only. Learn more