2
Even numbers I managed to sort, only odd numbers I can’t sort. The memory address of the number appears.
Link to the question: Even and Odd
Here is my code:
#include <stdio.h>
int main(int argc, char** argv)
{
    int teste, i, j, aux, aux1, c1 = 0, c2 = 0;
    scanf("%d", &teste);
    int vetor[teste], par[teste], impar[teste];
    for(i = 0; i < teste; i++)
    {
        scanf("%d", &vetor[i]);
    }
    for(i = 0; i < teste; i++)
    {
        if(vetor[i] % 2 == 0)
        {
            par[i] = vetor[i];
            c1++;
        }
        else
        {
            impar[i] = vetor[i];
            c2++;
        }
    }
    for(i = 0; i < teste - 1; i++)
    {
        for(j = i + 1; j < teste; j++)
        {
            if(par[i] > par[j])
            {
                aux = par[i];
                par[i] = par[j];
                par[j] = aux;
            }
        }
    }
    for(i=0;i<teste-1;i++)
    {
        for(j=i+1;j<teste;j++)
        {
            if(impar[i]<impar[j])
            {
                aux1=impar[i];
                impar[i]=impar[j];
                impar[j]=aux1;
            }
        }
    }
    for(i=0;i<c1;i++)
    {
        printf("%d\n",par[i]);
    }
    for(i=0;i<c2;i++)
    {
        printf("%d\n",impar[i]);
    }
    return 0;
}
						
I would like to understand what is wrong in the answer.
– Maniero
I was wrong at the time of the odd and odd quantity, thank you for your help
– rafael marques