I am new to LeetCode and am trying to improve upon my problem solving techniques. I am attempting to solve the Two Sum Problem in C and have run into trouble with the final return statement. The code initially provided to me by LeetCode was a function called "int* twoSum" and the goal is to find the two indices in an array that produce the target number. The function lists a couple parameters that I assumed were provided in main since it was not shown.
I changed the name of the function to just "int twosum" and removed the int* returnSize because I am not a big fan of unnecessary pass by address instead of by value and felt it wouldn't have a significant impact. However, after trying to run my code I run into the warning error: "returning 'int *' from a function with return type 'int' makes integer from pointer without a cast"
Could someone who understands this issue or has solved the problem before on LeetCode please provide insight as to what I need to correct? Thank you.
int twoSum(int *nums, int numsSize, int target){
int outerCount; //loop control variable for outer loop
int innerCount; //loop control variable for inner loop
int array[2]; //array that stores indices of numbers that produce target
for(outerCount = 0; outerCount < numsSize; outerCount++)
for(innerCount = outerCount + 1; innerCount < numsSize; innerCount++)
{
if(nums[outerCount] + nums[innerCount] == target)
{
array[0] = outerCount;
array[1] = innerCount;
}
}
return array;
}