Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Dark GDK / using globals in my program noob!

Author
Message
TRADEmyGAME
15
Years of Service
User Offline
Joined: 22nd Apr 2009
Location:
Posted: 14th May 2009 19:13
hi all, yes im a noob, i look all around the threads ,im also a noob at that, but i cant find!,,

im trying to us a varrible in a function,
but the function cant see the varrible ,
i guess because the varrible is not defined a Global Varrible.
How do i turn ---> int myvarrible = 1 ;
into ------------> Global int myvarible = 1 ;
using DarkGDK

i hope you can help, thanks!!

IveBeenProgramming;
SinceICanRemember;
ButICan'tRememberHowToProgram;
Zotoaster
19
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 14th May 2009 19:25
You can always pass the variable in as a parameter, for instance,


jezza
16
Years of Service
User Offline
Joined: 8th Mar 2008
Location: Bham, UK
Posted: 14th May 2009 19:39
To have a global variable, just declare it outside of any function.

WH8
15
Years of Service
User Offline
Joined: 17th Mar 2009
Location:
Posted: 14th May 2009 22:49 Edited at: 14th May 2009 22:50


You get the idea. As long as it is declared outside the DarkGDK function, it is global. Make sure that it is above the DarkGDK function and NOT below it.

You can also make a variable local to a specific function by declaring the variable in that function.
TRADEmyGAME
15
Years of Service
User Offline
Joined: 22nd Apr 2009
Location:
Posted: 15th May 2009 07:21
Zotoaster grate example but i think im still too noobish for that,,
as for jezza & WH8 on the money,it works,, i learn somting new every day thanks all of you, i read alot of these threads on this forum and recall your names, so when i saw Zotoaster answering my question it felt like i was chatting with someone famous, thanks again !

IveBeenProgramming;
SinceICanRemember;
ButICan'tRememberHowToProgram;

Login to post a reply

Server time is: 2024-10-01 01:17:50
Your offset time is: 2024-10-01 01:17:50