Add an element to C array only if element does not exist
<p>I am trying to learn how to code in C, and I am trying to add unique characters to an array, from an input array, only if the character does not already exist in the unique array, in a very simple way.</p>

<p>I am really stumped and would appreciate some assistance how to think it through correctly.
Here's my code:</p>

<pre><code>    /* get each character and how many times it shows up 
 * to do this we need to store each unique char in a char array, and the count for each
 * unique char in an int array */
char unique_chars[count];
for(int each = 0; each &lt; count; ++each)
    unique_chars[each] = '0';

/* count is the total number of chars stored in theinput array. */
int no_times = 0;

for(int each = 0; each &lt; count; ++each)
{
    if(theinput[each] != unique_chars[each])
        unique_chars[each] = theinput[each];
    if(theinput[each] == unique_chars[each])
        continue;

    for(int item = 0; item &lt; count; ++item){
        if(theinput[each] == unique_chars[item]){
            ++no_times;
        } 
    }
    printf("%c is in theinput array %d times.\n", theinput[each], no_times);
    no_times = 0;
}
 /* print all the values in the unique_chars array*/
 printf("values in unique_chars are: \n");
 for(int each = 0; each &lt; count; ++each);
 printf("\n");       

 return 0;
</code></pre>

<p>This is one of the many things I have tried. It returns the following:</p>

<pre><code>./uniquely
exsss
The characters typed in are: exsss
Number of characters are: 6
values in unique_chars are: 
e x s s s 
</code></pre>

<p>Please how can I do this right?</p>