this is the function code:
void statistics(int arr[], int n, int *positive, int *even, int *doubledigit)
{
int i = 0, countP = 0, countE = 0, countD = 0;
for(i = 0; i < n; i++)
{
if(arr[i] > 0)
countP++;
if((arr[i] % 2) == 0)
countE++;
if(abs(arr[i]) >= 10 && abs(arr[i]) < 100)
countD++;
}
*positive = countP;
*even = countE;
*doubledigit = countD;
}
void main()
{
// double mat[size][size];
int *positive = NULL, *even = NULL, *DoubleDigit = NULL;
int arr4[] = {1, 3, 5, -45, 8, 8, 60, 800};
int soa = sizeof(arr4);
statistics(arr4, soa, &positive, &even, &DoubleDigit);
}
the problem is that the result of the even numbers is 28:
why is it 28?? it should count the even numbers... https://i.stack.imgur.com/dS2us.png