Hi guys, something must be wrong with my logic here... I am trying to find the number of occurences of all the numbers from my array. Basically, I have one array filled with numbers, and I am creating another one with occurences. I thought this way:
Code:
for(i = 0; i < SIZE; i++)
{
search = numbers[i];
for(j = 0; j < SIZE; j++)
{
if(numbers[j] = search)
occurences[i]++;
}
}
So, I'm taking the first number, and check whether it is repeated in the rest of the array. If it is, the loop adds one to the occurences array with the same subscript as the number I was just looking at.
However, the results I am getting is 100 (the size of my arrays) filled in every cell of my occurences array. I messed it up somewhere in the loops. Where?