1. Write a C program function called ‘changeEven’ that changes all the even numbers within an array to 0, using pointer arithmetic

PHOTO EMBED

Wed Aug 09 2023 15:03:31 GMT+0000 (Coordinated Universal Time)

Saved by @Codes

// Online C compiler to run C program online
#include <stdio.h>

void changeEven(int a[], int *p){
    for(int i = 0; i < 5; i++){
        if(a[i]%2==0){
            a[i] = 0;
        }
    }
    for(int i = 0; i< 5; i++){
        printf("%d", a[i]);
    }
    
}

int main() {
    int a[5] = {8,4,3,7,2};
    int x;
    a[5] = x;
    changeEven(a,&x);
   

    return 0;
}
content_copyCOPY