#include<stdio.h> int main(void) { void sum_diff(float op1,float op2,float *psum,float *pdiff); float psum,pdiff; float op1,op2; //输入op1,op2,并且是float,所以用%f; printf("输入:"); scanf("%f%f",&op1,&op2); //调用自定义函数; sum_diff(op1,op2,&psum,&pdiff); printf("*psum=%f,*pdiff=%f",psum,pdiff); return 0; } //已经使用了指针指示结果。所以不需要返回值。 void sum_diff(float op1,float op2,float *psum,float *pdiff) { *psum=op1+op2; *pdiff=op1-op2; }