topical media & game development
professional-program-12-Static-StaticsInFunctions.c
? /
professional-program-12-Static-StaticsInFunctions.c
include <iostream>
using namespace std;
void performTask()
{
static bool inited = false;
if (!inited) {
cout << "initing\n";
// perform initialization
inited = true;
}
// perform the desired task
}
int main(int argc, char** argv)
{
performTask();
performTask();
return (0);
}
(C) Æliens
20/2/2008
You may not copy or print any of this material without explicit permission of the author or the publisher.
In case of other copyright issues, contact the author.