Q:

How to delete duplicated values in array in C? 

I want to delete duplicates values in array.  For example: array[1,5,6,1,3,5,9] I want to have array[6,3,9]. 
I have written this, but I am having troubles: 
#include<stdio.h>
main() {
    int array[50], i, j, k=0, c=0, array2[50], n;
    printf("Enter array dimension: "); scanf("%d", &n);
    for (i = 0; i < n; i++) {
        printf("array[%d]= ", i); scanf("%d", &array[i]);
    }
    for (i = 0; i < n; ) {
        for (j = i + 1; j < n; j++) {
            if (array[i] == array[j])
                i++;
            else {
                array2[k++] = array[i];
                c++;
            }
        }
    }
    for (k = 0; k < c; k++) {
        printf("%d  ", array2[k]);
    }
    system("pause");
}

A:

You should start by describing your problem in pseudo code, and breaking it into smaller pieces. 
Start from scratch by deleting all these redundant variables, and try to implement the following algorithm:
for each element in inputArray
   if not elementIsDuplicate(element)
      add to outputArray

That's a single for loop.  The elementIsDuplicate is separate function. 
Now try to implement the function elementIsDuplicate.  This function also contains a single loop, takes input parameters (int* array, int n, int currentIdx) and returns 1 or 0 indicating whether the element at currentIdx occurs anywhere else in the array. 

A:

#include<stdio.h>

int main(){
    int array[50], i, j, k=0, c, n, array2[50] = {0};
    printf("Enter array dimension: "); scanf("%d", &n);
    for (i = 0; i < n; ++i){
        int num, dup = 0;
        printf("array[%d]= ", i); scanf("%d", &num);
        for(j = 0; j < k; ++j){
            if(array[j] == num){
                array2[j] = dup = 1;
                break;
            }
        }
        if(!dup){
            array[k++] = num;
        }
    }

    for (c=i=0; i < k; ++i){
        if(!array2[i])
            printf("%d ", array[c++] = array[i]);
    }
    printf("\n");
/*
    for(i=0;i<c;++i)
        printf("%d ", array[i]);
    printf("\n");
*/
    system("pause");
    return 0;
}

