I am making a function that lists an array and says how many times each element appears.
What I have thought of on my own so far is i should loop through the array and t
I have posted a pseudocode, to help you with the algorithm which you said you are unable to understand. I hope this will encourage you to start the code.
//store the first number in a variable and find
//how many times it occurs in the array, repeat this for all
//the elements in the array
int current = arr[0];
int i=0, count=0;
for(i=0; i < arr.length;i++){ // loop through all the elements of the array
if(arr[i]==current) {
count++; // if current number is same as the number you are looking for
// then increment the counter
} // end of if-loop
}