Hi,

I'm new to the forum and I need some help.
My task is to write a program which defines a function to search through a fixed size
array of integers and count the longest sequence (consecutive repetition) of a specific
element in the array. The array and the search element are to be passed as a parameter
to the function and the longest repetition is the result.

For example:

If the following array of 10 integers is input by the user:

1 1 2 2 3 1 1 1 2 3

and the element that you want to find the longest sequence of is 1,
then the program should return the number 3 as the answer.
(because the most consecutive repetitions of 1 in the array at any given point is 3)

I have finished the code to greet, prompt and receive the input from the user, store the
input into an array and execute a print statement for the answer. All of the for loops and
while loops are written including an exit value for when the user would like to quit. I have
created the function, declared the function prototypes and have the proper variables
being passed between the function and main.

However, I am having trouble getting my function to work. I am not sure how to correctly
go about writing the code for the actual searching of the array elements.

I know I need to look at each element separately.
I don't know how to put that into code.

I know I need to then determine if it is equal to the following element in the array.
I don't know how to put that into code.

I know that if it is equal to the next element then I should increment a counter by one to
count how many times it repeats and when the program hits a new number, the value in
the counter should be stored into a new array that will contain the values of the length
of each consecutive repeated number.
I don't know how to put that into code.

Once I have the array containing the lengths of the repetitions, I know how to write the
code to find the max value in that array and print it, but getting to that point is my problem.

If anyone has any suggestions as to how I should begin to code this function,
I would greatly appreciate your help.

.