编写函数求倒数
想问一下这个程序怎么写。。。谢谢
以下程序的功能是:首先在main函数中输入一个数,然后在被调函数rev中求出这个数的倒数,最后在主函数中输出结果。要求写出函数rev。
#include <stdio.h>
void rev(double *p);
int main()
{double x;
scanf("%lf",&x);
if(x==0)
printf(“input error\n”);
else
{rev(&x);
printf("%f\n",x);
}
return 0;
}
/* 请在这里填写答案 */