QuickC

Vincent C. Hatem vch at attibr.UUCP
Sat Aug 27 08:14:19 AEST 1988


In article <8808261424.AA11504 at ucbvax.Berkeley.EDU>, TURGUT at 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  



More information about the Comp.lang.c mailing list