in sharepoint there is a form of global varibles but not in the sense your talking about! i presume your talking about a class (sharepoint) and within that class you have a global varible. Unfortunatly in sharepoint its not quite like that its more in the sense of using the following:
there are multiple ways to go about this! firstly it depends on how long, what info is stored and who is going to use it.... lets not forget the architecture of your sharepoint setup as that has a vital role todo with speed/time and resources!
for simplicity if its a varible that you want to easily pass through pages than i would use session state / view state varible! it will pass the varible through pages after postback ready for you to use:
How to save variables per user session per page
if you need two webparts to communicate with each other passing values than it would be somthing else! you would connect the two webparts together! so one is a sender and the other is a reciver!
if you need to sore the info for a period of time over night or days/weeks/months/years than that would be within a list or within the sql server!