Question: I am very new to C and I am hoping for some pointers. I am attempting to take an input of 7 integers of an array and search through them to see if any number appears only once. Here is what I have so far:

```
#define size 7
int main(void)
{
int array[size], target, i, prev, count;
//Initialize the array
printf("Please enter %d integers", size);
scanf("%d", &target);
prev = array[0];
count = 1;

for(i = 0; i<size; i++)
{
scanf("%d", &array[i]);
...

```

I realize it is quite terrible but C is completely strange to me. I figured out how to input the 7 integers from the user but I haven't the first clue as to where to start attempting to index them. I also realized that there are more advanced ways to figure it out; however, I am attempting find the solution using basic concepts that an amateur could understand.

Answer: 
The simplest way to search for duplicates (though not the most efficient one) is to sort the array. You can use the built-in `qsort` function as such:

```
int compare (const void * a, const void * b)
{
  return ( *(int*)a - *(int*)b );
}

/* ... */

qsort (array, size, sizeof(int), compare);

int seen = 0;
for (int i = 1; i < size; ++i) {
  if (array[i] == array[i - 1]) {
    if (!seen) {
      printf("%d\n", array[i]);
      seen = 1;
    }
  } else {
    seen = 0;
  }
}

```
I know 3 methods to find duplicates, 2 are already answered, so here is the third (simplified)-

Complexity O(N) time, O(M) memory. 

If the numbers are within some range like `0 - M` and `M` is comparable to `N` the number of elements, you can use a array of size `M+1` to check if the number has appeared before.

Code - 

```
int exists[M+1]; //set M to appropriate value
memset(exists, 0, sizeof(exists)); //set all 0 
for (i = 0; i < N; i++)
{
  if (exists[array[i]])
  {
    printf("Duplicate found\n");
    break; //or something else
  }
  exists[array[i]] = 1;
}

```

Note - Don't forget that input elements should be positive integers, not greater than `M`