Re: [Dev-C++] Global to local variables
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Abhijit S. <mu...@gm...> - 2002-04-21 05:36:12
|
Use the 'static' keyword. For example
MyFunction()
{
static int TimesCalled =3D 0; // Default value, assigned on =
the first call
TimesCalled ++;
printf("TimesCalled is %d\n", TimesCalled);
}
mdeth O
m.o.t.o[P.S.Y.C.H.O]=20
http://mudeth.tripod.com | ibr...@bi... | mu...@gm...
----- Original Message -----=20
From: David McKen=20
To: Dev-C Mailing List=20
Sent: Sunday, April 21, 2002 2:11 AM
Subject: [Dev-C++] Global to local variables
I have global varibles in my program that are used by one function
to keep track of it's state. Is there a way to have a local varible=20
to keep it's value between calls?
__________________________________________________
Do You Yahoo!?
Yahoo! Games - play chess, backgammon, pool and more
http://games.yahoo.com/
_______________________________________________
Dev-cpp-users mailing list
Dev...@li...
https://lists.sourceforge.net/lists/listinfo/dev-cpp-users
|