#include <stdio.h>
#include <stdlib.h>
void fun(int* p1, int* p2, int* s)
{
s = (int*)malloc(sizeof(int));
//s = (int*)calloc(1,sizeof(int));
*s = *p1 + *(p2+1);
}
int main()
{
int arr1[2] = {1, 2}, arr2[2] = {10, 20};
int* s = arr2;
fun(arr1, arr2, s);
printf("%d\n", *s);
}
//由於malloc或者calloc會重新分配內存所以輸出不等於21
//最後輸出應該等於10