title: How to perform A-B set operation in C program using builtin library
body: <p>I am new to C language. Suppose I have two arrays <code>a</code> and <code>b</code></p>
  
  <pre><code>int a[10] = { 1,2,3,4,5,6,7,8,9,0 };
  int b[10] = { 1,3,5,7,9 };
  </code></pre>
  
  <p>and I want to perform <code>a-b</code> so that I can get all elements of array <code>a</code> which are not present in array <code>b</code>. In ruby or python, I can just simply do <code>a-b</code> and get the result. Here is my c code that I have tried but my code which is not working.I am looking for a C library that does this operation for me in a line.I have also found this <a href="http://www.mission-base.com/peter/source/pbl/doc/set.html" rel="nofollow noreferrer">library</a> but not sure how to implement it. Any kind of help is appreciated.</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #define Max 100
  
  int m,n,i,j,k,p,q,r,s;
  int flag=1;
  char char1,char2,char3;
  void Difference(int *,int *,int ,int);
  void Display2(char ,char ,int );
  
  int a[10] = { 1,2,3,4,5,6,7,8,9,0 };
  int b[10] = { 1,3,5,7,9 };
  int c[10];
  
  void Difference(int *a1,int *b1,int m1,int n1)
  {
      q=0;
      p=0;
      i=0;
      for(k=0;k&lt;m1;k++){
          flag=1;
          for(j=0;j&lt;n1;j++){
              if(b1[j]==a1[k]){
                  flag=1;
                  q++;
                  break;
              }
              else{
                  flag=0;
              }
          }
          if(flag==0){
              c[p]=a1[k];
              p++;
          }
      }
  }
  
  void Display2(char ac,char bc,int m1)
  {
      printf("\nThe Difference Of Two Sets i.e '%c - %c' Is : { ",ac,bc);
      r = m1 - q;
      for(p=0;p&lt;r;p++){
          printf("%2d",c[p]);
      }
      printf(" }");
  }
  
  
  int main(){
      Difference(a,b,m,n);
      Display2('A','B',m);
      return 0;
  }
  </code></pre>