我把代码块写在了系统提供的函数里,但结果显示输出错误
/**
* Note: The returned array must be malloced, assume caller calls free().
*/
int* twoSum(int* nums, int numsSize, int target, int* returnSize){
returnSize = NULL;
int i,j;
for(i=0;i<numsSize-1;i++){
for(j=i+1;j<numsSize;j++){
if(nums[i]+nums[j]==target){
returnSize = (int*)malloc(sizeof(int)*2);
returnSize[0] = i;
returnSize[1] = j;
return returnSize;
}
}
}
return returnSize;
}