Path: utzoo!utgpu!water!watmath!clyde!att!rutgers!bellcore!faline!thumper!ulysses!attibr!vch From: vch@attibr.UUCP (Vincent C. Hatem) Newsgroups: comp.lang.c Subject: Re: QuickC Summary: funny... mine doesn't Message-ID: <43@attibr.UUCP> Date: 26 Aug 88 22:14:19 GMT References: <8808261424.AA11504@ucbvax.Berkeley.EDU> Organization: AT&T International, Basking Ridge, NJ Lines: 41 In article <8808261424.AA11504@ucbvax.Berkeley.EDU>, TURGUT@TREARN.BITNET (Turgut Kalfaoglu) writes: > The other day, I was struggling with QuickC - a very simply problem, > but really intriguing. Let me know if you can interpret this: > main() > { > int a,v; > a = 2; > v = square(a); > printf("%d\n",v); > } > square(num) > int num; > { > num = num*num; > } > OK? There is no 'return' statement in the function. However, it works! > I get '4' as an answer. So I thought maybe it was keeping the result I took the above program, copied it with the swipe of a mouse, and compiled it... I get: $ cc test1.c -o test1 $ test1 -1073610208 Hmm... What's this QuickC??? An interpreter? I suspect that the compiler is putting the variable "num" on the stack, which is being picked up by the main(). I guess AT&T got something right ;-} Vince -- Vincent C. Hatem | att ---->\ (available from any AT&T International | ulysses ->\ Action Central site) International Operations Technical Support | bellcore ->\ 1200 Mt Kemble Ave, Basking Ridge, NJ 07920 | ihnp4 ----->\__ !attibr!vch