69,382
社区成员
发帖
与我相关
我的任务
分享
#include "stdio.h"
#include <stdlib.h>
void fun(float *p1, float *p2, float *s)
{
s=( float * )calloc( 1, sizeof(float)); //heap
*s=*p1 + *p2;
}
int main(int argc, char* argv[])
{
float a[]={1.1,2.2},b[]={3.3,4.4};
float * s=a;
fun(a, b, s);
printf("%f\n",*s);
return 0;
}