#include<stdio.h>
int a;
int fun(int b)
{
static int c=3;
return ((++a)+(++b)+(++c));
}
Main()
{
int i,a=2;
for(i=0;i<2;i++)
printf("%5d",fun(a));
}
I think answer is 1012 but don't have comp
I wanna know progress
#include<stdio.h>
int a;
int fun(int b)
{
static int c=3;
return ((++a)+(++b)+(++c));
}
Main()
{
int i,a=2;
for(i=0;i<2;i++)
printf("%5d",fun(a));
}
I think answer is 1012 but don't have comp
I wanna know progress
in response to Frank Hao comment
Global int a
is initialized as 0.
for i = 0;
first call fun(2)
{
return ((1)+(3)+(4));
}
for i = 1;
second call fun(2)
{
return ((2)+(3)+(5));
}