function call pointer(指针)遇到的问题....
感觉没有错啊!但计算答案是一直出现address而不是value.....
#include <stdio.h>
void addFractions(int nrator1,int denom1,int nrator2,int denom2,int *nratorSum,int *denomSum);
int main()
{
int nrator1,denom1,nrator2,denom2,nratorSum,denomSum;
printf("Please enter the first fraction with numerator and denominator respectively :\n");
scanf("%d%d",&nrator1,&denom1);
printf("\n");
printf("Please enter the second fraction with numerator and denominator respectively :\n");
scanf("%d%d",&nrator2,&denom2);
printf("The value sum of 2 fraction is :\n");
printf("%d/%d+%d/%d=%d/%d\n\n",nrator1,denom1,nrator2,denom2,*nratorSum,*denomSum);
addFractions(nrator1,denom1,nrator2,denom2,&nratorSum,&denomSum);
return 0;
}
void addFractions(int nrator1,int denom1,int nrator2,int denom2,int *nratorSum,int *denomSum)
{
*nratorSum=(nrator1*denom2)+(nrator2*denom1);
*denomSum=denom1*denom2;
}
顺便问问最简分数如何定义?
如果应用在c里有是怎样?