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 one is a little pain in the neck to read, so I explain what I did a little bit here:

First, include the standard i/o library, #define array size to whatever you want, declare you array (I called mine: int entries[SIZE];).

The first for loop after "Enter 10 numbers" is the main one, that allows you to push the 10 numbers into the array.

The following if statements are tests that are applied to value entered right after is typed:

1) The first if statement makes sure we enter the value within the proper range.

2) The following 'else if' suggests that if entries[i] = entries[0] (meaning if this is the first object in the array) let's not do anything because there's nothing to compare it to.

3) The last 'else' contains a nested loop. The outer loop gets initialized to 1 so we make sure that in the comparison that takes place in the inner loop we're always comparing the current value against a previous one.

I hope this helps... cheers :)

\*/

```
#include <stdio.h>

#define SIZE 10

//declarations
int entries[SIZE];

int main(void)
{
    printf("Enter 10 numbers:\n");

    for(int i = 0; i <= SIZE-1; i++)
    {
        printf("[%d]:\n", i);
        scanf("%d", &entries[i]);

        if(entries[i] < 10 || entries[i] > 100) {
            printf("Please enter valid number (between 10 and 100)\n");
            scanf("%d", &entries[i]);
        }
        else if(i == 0) {
            ;
        } else
        {
            for(int j = 1; j <= i; j++)
            {
                *//internal loop goes through all the previous entries (entries[i-1], entries[i-2], etc)*
                for(int k = 0; k < j; k++) {
                    if(entries[j] == entries[k])
                        printf("%d is a duplicate value\n", entries[i]);
                }
            }
        }
    }

}

```