RE: [Dev-C++] Global to local variables
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Ioannis V. <no...@ho...> - 2002-04-20 21:03:39
|
Yes using the keyword static. E.g.
void something(void)
{
static int x;
/* ... */
}
x keeps its value between function calls and is created only once. This
type of coding is not suitable for concurrent applications
(multithreading).
Ioannis
* Ioannis Vranos
* Programming pages: http://www.noicys.cjb.net
* Alternative URL: http://run.to/noicys
> -----Original Message-----
> From: dev...@li...
> [mailto:dev...@li...] On Behalf
> Of David McKen
> Sent: Saturday, April 20, 2002 11:41 PM
> To: Dev-C Mailing List
> 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
> 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
>
|