I have made a request in the URI problem 1566 statement, but it is giving presentation error, and I do not know how to fix it.
Here is my code:
#include <stdio.h>
#include <stdlib.h>
int ordena(const void *a, const void *b);
int main(int argc, char** argv)
{
int teste, num;
scanf("%d", &teste);
for(int i = 0; i < teste; i++)
{
scanf("%d", &num);
int vetor[num];
for(int j = 0; j < num; j++)
{
scanf("%d", &vetor[j]);
}
qsort(vetor, num, sizeof(int), ordena);
for(int j = 0; j < num; j++)
{
printf("%d ", vetor[j]);
}
printf("\n");
}
return 0;
}
int ordena(const void *a, const void *b)
{
if(*(int*)a == *(int*)b)
return 0;
else if(*(int*)a < * (int*)b)
return -1;
else
return 1;
}