Skip to main content
gamedev.net
🔒 Locked

Global variables

Started by thooot 0 replies 550+ views
Original Post
thooot
thooot
Is it possible to create a variable that is shared between various files? I tried making a static variable in a header class, but it seems like a different copy is made for each file. Anybody know a way around this? This is for VC++.
Crispy
Crispy
in a header file:

extern char varName;

in one of the code files:

char varName;

Crispy

"Literally, it means that Bob is everything you can think of, but not dead; i.e., Bob is a purple-spotted, yellow-striped bumblebee/dragon/pterodactyl hybrid with a voracious addiction to Twix candy bars, but not dead."- kSquared

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.