Question- Write a function int frequency (int theArray [ ], int n, int x) that counts the number of times the item x appears among the first n elements of theArray and returns that count as the frequency of x in theArray. Use integers for everything!
For case, if the array being passed contained the values 5, 7, 23, 8, 23, 67, 23
... and n was 7 and x was 23, then it would return a value of 3 since 23 occurs 3 times within the first 7 elements of the array. in C language
Will you write the code with less number of instructions? If yes, write the new code.