|
#include <stdio.h>
main(void)
{
int x, y;
int re, power (int,int);
printf ("input x,y");
scanf ("%d %d",&x,&y);
re = power (x,y);
printf ("x = %d,y =%d,re = %ld\n",x,y,re);
}
unsigned long int power (int x,int y);
{
int x,y;
unsigned long int z
if (y == 1)
return x;
else
if (y%2==0)
{
z = power (x,y/2);
return z*z;
}
else
return (x*power (x*(y-1) );
}
/*
我的系统计是
Red Hat EnterPrise Linux ES release 3
Kernet 2.421-9.EL on an i686
问题在这:
[root@localhost mypor]# gcc -o f ./f.c
f.c:14: syntax error before string constant
f.c:14: warning: conflicting types for built-in function `printf'
f.c:14: warning: data definition has no type or storage class
请问要如修改*/ |
|