Greetings fellow programmers,

I am having difficulty in making a function that checks an integer array for the number '3' and whichever number contains it, moves it to a new array and makes it in descending order.

I am stuck with the moving part and here is what I have done so far:

Code:

void check(int x[], char y[], int z[]){
int i, j = 0;
char c = 3;
for (i = 0; i < MAX; i++)
y[i]=x[i];
for (i = 0; i < MAX; i++)
while (y[i] != NULL)
{
if (y[i] == c)
{
z[j] = y[i];
j++;
}
}
for (i = 0; i < j; i++)
printf("array2[%d]=%d\n", i, z[i]);
}

I have a feeling that I am far away from making it works