Looking for static boolean using numcall tutorial

Looking for static boolean using numcall tutorial, if you can shed any light or lead me to a tut it would be much appreciated
Actual question. It keeps telling me I need to use numcall??

Write the definition of a function named alternator that receives no parameters and returns true the first time it is invoked, returns false the next time it is invoked, then true , false and so on, alternating between true /false on successive invocations.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
static bool alternator()
{
	int alternator;
	if (alternator % 2 == 0)
	{
		bool status = false;
		return false;
	}
	else  
	{
			bool status = true;
			return true;
		}
		alternator++;
}
1
2
3
4
5
bool alternator()
{
    static unsigned numcalls = 0;
    return ++numcalls % 2 == 1;
}
wont accept unsigned ? Ill get it just can't find documentation.
Topic archived. No new replies allowed.