1. ## Copy function

I am struggling at the following task:

Write a function called copy which takes the following parameters:

-Two integer arrays
-The size of the two arrays as an integer
-A threshold value as an integer

Your function should copy the values of the first array into the second array but ignore values above the given threshold.

I always get only 0 0 0 0 0 as output with my function. Does anybody now how I can fix this?

Code:
```int copy(int* arr1, int* arr2, int length, int d) {
for (int m=0; m< length;m++){

int min= arr1[m];
for(  int  i=m+1; i< length; i++){
if (min>arr1[i]){
arr1[i]=arr1[i-1];
}
else
min=min;
}
arr2[m]  = min;
}
for (int n=0; n< length;n++){
if (arr2[n] > d)
arr2[n]=0;
else
arr2[n]=arr2[n];
}
}``` 2. You need to copy the values from arr1 to arr2 only if they are greater than threshold. There is no need to find the min.

Maybe sth. like this:
Code:
```for (int i = 0; i < length; ++i)  {
if (arr1[i] > d)
// copy arr1[i] over to arr2``` 3. Thank you, it works Popular pages Recent additions copy, function, int, integer, threshold 