Problem statement:- There are n kids with candies. You are given an integer array candies, where each candies[i] represents the number of candies the ith kid has, and an integer extraCandies, denoting the number of extra candies that you have.
Return a boolean array result of length n, where result[i] is true if, after giving the ith kid all the extraCandies, they will have the greatest number of candies among all the kids, or false otherwise.
Note that multiple kids can have the greatest number of candies.
Input: candies = [12,1,12], extraCandies = 10 Output: [true,false,true]
for the above problem statement i am writing this below function:-
bool* kidsWithCandies(int* candies, int candiesSize, int extraCandies, int* returnSize) {
*returnSize = candiesSize;
// printf("%d ", *returnSize);
int *tempcandie = (int*)malloc(sizeof(int)*candiesSize);
int it1 = 0, it2, temp = 0;
bool result;
for (it1;it1 < candiesSize;it1++)
{
result = 1;
tempcandie[it1] = candies[it1] + extraCandies;
for (it2 = 0;it2 < candiesSize;it2++)
{
if (tempcandie[it1] <= candies[it2])
{
result = 0;
break;
}
}
tempcandie[it1] = result;
}
return (bool*)tempcandie;
}
if i run this function in my PC in visual studio then i debugger window i can see the tempcandie is holding expected result but if i am running on the one specific coding platform its showing different result what might be the issue
Visual basic debugger window :-

Platforms output:-
I am unable to figure out why i am getting difference in output

