Question: I am programming in C and the parameters are: Write a Write a function countEven(int*, int) which receives an integer array and its size, and

I am programming in C and the parameters are:

Write a Write a function countEven(int*, int) which receives an integer array and its size, and returns the number of even numbers in the array

Currently the function is outputting zero and I am not sure where to fix it. here is my code so far

int main(){

int Array[7] = {4, 5, 6, 7, 8, 9, 10}, size, num;

size=28;

printf("Number of even elements is %d", num);

return 0;

}

int countEven(int *Array, int size){

int num = 0, *number;

for (int j =0 ; j < size; Array++, j++){

number = Array+j % 2;

if (number == 0) {

num = num + 1;

}

}

return num;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!