int newints* = new int[10];
newintvar = 1;
//in the game_done() function
delete newints
could some1 please tell me if this is correct
a variably clarification question
Okay, i think i understand it but i wanted to clear this up. I need a way to declare globals on the spot. If i declare a variably in my game_init() function, my game_loop() fuction cannot access it so I think i know how to solve it. So would i have to do something like the following?
No, thats not what i meant. I meant something like creating a variable in a function that does not terminate when the function returns. I wanted it to be created in the game_init() function and deleted in the game_done() function.
Is that what you want ?
Edited by - Fruny on November 18, 2001 5:55:45 PM
int* newints; // at the top of the source file...voidgame_init(){ newints = new int[10];}void game_loop(){ newints[0] = 5; newints[1] = 10; }voidgame_done(){ delete[] newints;}
Edited by - Fruny on November 18, 2001 5:55:45 PM
How about something like this?
int* newInts;void Game_Init(void){ newInts = new int[10]; ...}...void Game_Done(void){ delete[] newInts; ...}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement