Code:
#include<stdio.h>
#include<stdlib.h>

int main()
{
    int i=0,j=0,n=0,a[10],flag=-1;
    for(i=0;i<10;i++)
    {
        a[i]=-1;
    }
    while(i<10)
    {
         n=rand()%10;
         for(j=0;j<10;j++)
         {
               if(n==a[j])
               {
                   flag=0;
                   break;
               }
               else
              {
                   flag=1;
              }
         }
         if(flag==1)
         {
              a[i]=n;
              i++;
          }  
     }
    for(i=0;i<10;i++)
    {
         printf("%d\n",a[i]);
     }  
}
when i compile and run the above code I get -1.
it should generate 10 unique random numbers between 10, but it does not...

i use gcc this is the output
Code:
$ gcc random.c
$ ./a.out 
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1