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;
  }
}

```
This can be done in O(n^2) algorithm:

```
int yes = 1, i, j;
for (i = 0; i < n; ++i)
{
   for (j = i + 1; j < n; ++j) if (arr[i] == arr[j])
   {
       printf("Found a duplicate of %d\n", arr[i]);
       yes = 0;
       break;
   }
   if (!yes) break;
}
if (yes) printf("No duplicates");

```