Write the definition of a function named counter that receives no parameters and returns 0 the first time it is invoked, returns 1 the next time it is invoked, then 2, 3 and so on.
.
.
Click on the title for the solution
.
.
int counter()
{
static int x = 0;
return(x++);
}
.
Click on the title for the solution
.
.
This is the answer:
:
int counter()
{
static int x = 0;
return(x++);
}
Comments
Post a Comment