R
rahul8143
hello,
why following both programs executes in different manner that
mean first goes in infinite loop and second one executes 0.
NOTE:- I am using Microsoft visual studio 6 to program C
programs.
1)
int funct2(int b)
{
if (b == 0)
return b;
else
funct1(b--);
}
int funct1(int a)
{
if (a == 0)
return a;
else
funct2(a--);
}
void main()
{
int a=7;
printf("%d",funct1(a));
}
2)
int funct2(int b)
{
if (b == 0)
return b;
else
funct1(--b);
}
int funct1(int a)
{
if (a == 0)
return a;
else
funct2(--a);
}
void main()
{
int a=7;
printf("%d",funct1(a));
}
regards,
rahul
why following both programs executes in different manner that
mean first goes in infinite loop and second one executes 0.
NOTE:- I am using Microsoft visual studio 6 to program C
programs.
1)
int funct2(int b)
{
if (b == 0)
return b;
else
funct1(b--);
}
int funct1(int a)
{
if (a == 0)
return a;
else
funct2(a--);
}
void main()
{
int a=7;
printf("%d",funct1(a));
}
2)
int funct2(int b)
{
if (b == 0)
return b;
else
funct1(--b);
}
int funct1(int a)
{
if (a == 0)
return a;
else
funct2(--a);
}
void main()
{
int a=7;
printf("%d",funct1(a));
}
regards,
rahul