Am I seeing things?
~XT4103000~Marc Mengel~C25~G25~6184~
mmengel at cuuxb.ATT.COM
Mon Jun 27 23:54:43 AEST 1988
In article <547 at tsc.dec.com> pete at tsc.dec.com (Pete Schmitt) writes:
>When I run the following code on a VAX running Ultrix 2.2 I get a
>correct output of:
[example output deleted]
>Where is the problem? Is this a bug?
/* lpowd.c */
main()
{
long b,e,a,lpow();
b = 2;
e = 4;
a = lpow(b,e);
printf("%d to the %dth = %d\n",b,e,a);
*****************^SPLAT should be %ld for a long int, you are printing
the low and high word of the 2, then the low
word of the 4...
}
long lpow(lnum, n)
long lnum;
long n;
{
long p;
p=1;
for ( ; n > 0; --n)
p *= lnum;
return (p);
}
--
Marc Mengel
attmail!mmengel
{lll-crg|mtune|ihnp4}!cuuxb!mmengel
More information about the Comp.sys.att
mailing list