Code:
Hi... i just start to learnt about pointer + function with array... this my toturial question.. now i try to do it..?
Write a function countEvent(int *, int) which receives an integer array and its size, and returns the number of even numbers in the array.


#include<stdio.h>
int countEvent(int *ptr, int size)
{
int i, even_cnt = 0;
for(i = 0; i<=size; i++)
{
if(*(ptr+1)%2 == 0)
even_cnt++;
}
return even_cnt;

}
int main ()
{
int array[10] = {1,2,3,4,5,6,7,8,9,10};
int even, count = 10;

even = countEvent(&array,count);

printf("%d\n", even);

return 0;
}

this is my program... it should be giving me answer 5 rather than 11; but i get the output is 11?? what happen with my program..

thank you very much~~