I'm still new to c++ so this is a learning process for me. Also i know that i should initially use a vector to do this but i have an exercise that specifies an array so i'm trying to write a function that removes all duplicate elements in an array but i receive the error
C2100: illegal indirection
if someone could point me in the right direction
int main()
{       
    int *t;
    int removel[9] = { 1, 1, 1, 2, 3, 4, 5, 6, 6, };
    t = removeAll(removel, 9, 1);
    for (int i = 0; i < 8; i++)
        cout << t[i] << " ";
}
int* removeAll(int list[], int listlength, int removeitem)
{
    int count = 0;
    int* list2;
    int removeindex;
    int length;
    int tempindex;
    for (int i = 0; i < listlength; i++)
    {
        if (removeitem == list[i])
            count++;
    }
    length =  listlength - (count + 1);
    list2 = new int[length];
    int j;
    while (j<=length)
    {
        remove_if(list[0], list[listlength - 1], removeitem);
        for (j = 0; j < length; j++)
            if (list[j] == NULL)// not sure what the remove_if func puts inplace of the removed element
                continue;
            else
                list2[j] = list[j];
    }
    return list2;
}