No matter how I change my code, the output is always empty...What's wrong with it?

```
int start = -1;
int end = -1;
int i = 0;
int *res = (int *)malloc(2 * sizeof(int));
while (i < numsSize) {
if (nums[i] == target) {
if (start < 0) {
start = i;
}
}
if (start >= 0) {
if ((i < numsSize - 1 && nums[i + 1] != target) || (i == numsSize - 1)) {
end = i;
break;
}
}
i++;
}
res[0] = start;
res[1] = end;
return res;
```