Help with array duplication in C

Hi guys, I’m new to Code Chef and an amateur programmer. I have been working on the turbo sort problem and I have it sorting the values in the array in numerical order, which seems to work fine. After 3 days I finally have it removing duplicate values but it only works if there are two duplicate values. If I enter three “1’s” for example it doesn’t work.

This is the code I have so far. Could anyone give me some tips on how to fix it and areas of the code where I could obviously improve upon. bad habits etc… ?

#include <stdio.h>
#include <stdlib.h>
int comp ( const void * a, const void * b )
int main ()
int t, n, i, x, dupl, count=0;
n < 10^6;
scanf ("%d",&t);
int arr[t];
int newArr[count];

    dupl = 0;
    scanf ("%d",&n);
    for (x = 0;  x < t ; x++) {
        if (n == arr[x]) {
            dupl = 1;
    if (!dupl)
        arr[i] = n;
        newArr[i] = n;


qsort( newArr, count, sizeof(int) ,comp );
return 0;