#include<stdio.h>
addUp(int a,int b,int c)
{
c=a+b;
printf("%d\n",c);
return c;
}
main()
{
int c;
addUp(6,5,c);
printf("%d",c);
}
可以在函数中完成数字的加减但是发现无法再主函数中调用,是个初始值22,所有得想个办法将函数的值传递到主函数中。
#include<stdio.h>
addUp(int *p,int *q,int *o)
{
*o=*p+*q;
}
main()
{
int a=6,b=5,c;
addUp(&a,&b,&c);
printf("%d",c);
}
运用取址符号完成函数参数的调用。