#include #include // Return the number of elements that are odd at // corresponding indexes of both arr1 and arr2 int count_odd(int size1, int arr1[], int size2, int arr2[]) { // if we had two lists instead of two arrays // int count_odd(struct node *head1, struct node *head2) int count = 0; int i = 0; // struct node *tmp1 = head1; // struct node *tmp2 = head2; while(i < size1 && i < size2) { //while (tmp1 != NULL && tmp2 != NULL) if (arr1[i] % 2 != 0 && arr2[i] % 2 != 0) { // if (tmp->data % 2 != 0 && tmp2->data % 2 != 0) count++; } i++; // tmp1 = tmp1->next; // tmp2 = tmp2->next; } return count; } int main(void) { // Only your function is called during testing // Any changes in this main function will not // be used in testing int array1[] = {9, -3, 1, 5, 2}; int array2[] = {3, 2, -7, 6}; printf("%d odd at the same index\n", count_odd(5, array1, 4, array2)); return 0; }