int counter(int i)
{
static int count = 0;
count = count + i;
return count;
}
void main()
{
int i, j;
for(i = 0; i <= 5; i++)
j = counter(i);
}
What is the value of J at the end of the program
0+(0+1+2+3+4+5)=15
The value of j is
<!--
5 ?
Because it goes through the loops about 6 times, but what was written previously gets overwritten with each iteration of the loop?
Wait, no Static, which means it should be 15?
I am sticking with 15, but "static int count = 0;", wouldn't that reset count back to 0 at the start of each loop?
-->