Well i think this is related to stack and how the data
is stored
by the OS in stack.
I had put sleep before calling printf statement and
the return result was 0. Or if we give a specific
return then that value appears in the printf.
Well if anyone knows about this then do enlighten.
Ciao
Tapesh
--- Tahir Hashmi <code_martial(a)softhome.net> wrote:
****************************************
* LUG meet on 12 Jan. 2003 @ VJTI
****************************************
On Wed, 18 Dec 2002 08:29:38 +0530
Abhijeet D Mhatre wrote:
# include <stdio.h>
main(){
int fact;
int x;
fact=factorial(6);
printf ("%i\n",fff());
}
int factorial(int x){
if(x>1) return(x*factorial(x-1));
}
int fff () {
;
}
Naturally I was expecting 1 as the answer. But I
am getting the
answer 720 which is 6!.
Why were you expecting 1? Could you really expect
any particular
value from a call to fff()?
__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com