For this function, I have to count how many even numbers there are in this array. It compiles fine and I get no warnings but when I run it, nothing gets outputted! I'm baffled because I've done this function before and do not know why this is happening. As always any help is appreciated.
Code:
#include <iostream>
using namespace std;
int EVEN (int a[],int size );//prototype
int main()
{
const int size=10;
int a[size]={1,2,3,4,5,6,7,8,9,10};
cout<<"The number of evens in this array are";
EVEN(a,size);//call
return 0;
}
int EVEN(int a[], int size) //print number of even elements
{
int e=0;
for(int i=0;i<size;i++){
if((a[i]%2)==0)
e++;
return e;
}
return 0;
}