Original Post
Hello everyone,
I have a question about using global variables in a game.
Usually what I do to store my globals is to create a source file with all my globals declared and initialized within it along with a header file with the same globals defined as externals. I then just include the header file wherever I want to use the globals.
// Example.cpp
int Global1 = 0;
int Global2 = 0;
int Global3 = 0;
// Example.h
extern int Global1;
extern int Global2;
extern int Global3;
I was wondering if this is the most effective way to do this. I've asked a friend of mine and he thinks it's a perfectly acceptable way to handle globals.
Any other opinions or alternate methods?
Thanks,
Reaptide
Edited by - Reaptide on 8/24/00 7:10:56 PM