Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a void function that takes as parameters two arrays and the number of the

ID: 3906259 • Letter: W

Question

Write a void function that takes as parameters two arrays and the number of the elements to compare. If they are the same, the function should return 1, 0 otherwise. Write a program that reads 200 double numbers and splits them in two arrays. Then, the program should read the number of the elements to be compared and use the function to compare them. (Hint: since the return type is void add a pointer argument to return that value.)
Write a voia function that takes as parameters two arrays and the number of the elements to compare. If they are the same, the function should return 1, 0 otherwise. Write a program that reads 200 double numbers and splits them in two arrays. Then, the program should read the number of the elements to be compared and use the function to compare them. (Hint: since the return type is void add a pointer argument to return that value.) 115 Writa a ueac

Explanation / Answer

If you have any doubts, please give me comment...

#include<stdio.h>

void compare(double arr1[], double arr2[], int *status);

int main(){

double arr1[100], arr2[100], num;

int status, i;

printf("Enter 200 double numbers: ");

for(i=0; i<200; i++){

if(i<100)

scanf("%lf", &arr1[i%100]);

else

scanf("%lf", &arr2[i%100]);

}

compare(arr1, arr2, &status);

if(status)

printf("Both array are equal ");

else

printf("Both are not equal ");

return 0;

}

void compare(double arr1[], double arr2[], int *status){

int i;

for(i=0; i<100; i++){

if(arr1[i]!=arr2[i]){

*status = 0;

return;

}

}

*status = 1;

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote