Am I seeing things?

Pete Schmitt pete at tsc.dec.com
Sat Jun 25 00:08:53 AEST 1988


When I run the following code on a VAX running Ultrix 2.2 I get a
correct output of:
			2 to the 4th = 16

When I run it on a 6300+ running V2.5 unix I get:

			2 to the 0th = 4

Where is the problem?  Is this a bug?

The code:


/* 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);
}
	
long lpow(lnum, n)
	
	long lnum;
	long n;
	{
		long p;
		p=1;
		for ( ; n > 0; --n)
			p *= lnum;
		return (p);
	}



More information about the Comp.sys.att mailing list