Description:Given an array of integers, return indices of the two numbers such that they add up to a specific target.
You may assume that each input would have exactly one solution.
solution:
int* twoSum(int* nums, int numsSize, int target) {
int i,j;
int *p; //初始化指针
for(i=0;i<numsSize;i++){
for(j=i+1;j<numsSize;j++){
if(nums[i]+nums[j]==target){
p=(int*)malloc(2*sizeof(int));
p[0]=i;
p[1]=j;
}
else{
continue;
}
}
}
return p;
}