For my computer science class I have to write a function that will count the even numbers in an array and for some reason my code is failing. I think it might have something to do with pointers.
1 2 3 4 5 6 7 8 9 10
int countEvens(int a[], int size) {
int count = 0;
for (int i = 0; i <= size-1; i++) {
if (a[i]%2 == 0)
count++;
}
return count;
}