title: error: invalid types 'int[int]' for array subscript
body: <pre><code>#include &lt;iostream&gt;
  using namespace std;
  int t,n,k,m,i,j;
  int l[100002],r[100002],c[100002],a[100002],total=0;
  int swap( int *a, int *b)
  {
      int temp=*a;
      *a=*b;
      *b=temp;
  }
  int pivot( int l, int h)
  {
      int x=c[h],i=l,j=l-1,temp;
      for(i=l;i&lt;h;i++)
      {
          if(c[i]&lt;x)
          {
              j++;
              swap(&amp;c[i],&amp;c[j]);
              swap(&amp;r[i],&amp;r[j]);
              swap(&amp;l[i],&amp;l[j]);
          }
      }
      j++;
      swap(&amp;c[h],&amp;c[j]);
      swap(&amp;l[h],&amp;l[j+1]);
      swap(&amp;r[h],&amp;r[j+1]);
      return j;
  }
  int quick( int l, int h)
  {
      int p;
      if(l&lt;h)
      {
          p=pivot(l,h);
          quick(l,p-1);
          quick(p+1,h);
      }
  }
  int main() {
      cin&gt;&gt;t;
      while(t--)
      {
          total=0;
          cin&gt;&gt;n&gt;&gt;k&gt;&gt;m;
          for(i=1;i&lt;=n;i++)
          {
              cin&gt;&gt;a[i];
              total+=a[i];
          }
          for(i=1;i&lt;=m;i++)
              cin&gt;&gt;l[i]&gt;&gt;r[i]&gt;&gt;c[i];
          quick(1,m);
          for(i=1;i&lt;=m;i++)
              cout&lt;&lt;l[i]&lt;&lt;r[i]&lt;&lt;c[i]&lt;&lt;endl;
      }
      return 0;
  }
  </code></pre>
  
  <p>In the above code I am getting the following error.</p>
  
  <pre><code>prog.cpp: In function 'int pivot(int, int)':
  prog.cpp:21:13: error: invalid types 'int[int]' for array subscript
      swap(&amp;l[i],&amp;l[j]);
               ^
  prog.cpp:21:19: error: invalid types 'int[int]' for array subscript
      swap(&amp;l[i],&amp;l[j]);
                     ^
  prog.cpp:26:11: error: invalid types 'int[int]' for array subscript
    swap(&amp;l[h],&amp;l[j+1]);
             ^
  prog.cpp:26:19: error: invalid types 'int[int]' for array subscript
    swap(&amp;l[h],&amp;l[j+1]);
                     ^
  </code></pre>
  
  <p>Can you figure out what the error is? And also I am wondering why I am getting this error only in array <code>l</code> not in <code>r</code> or <code>c</code>. So please explain this also.</p>
  
  <p>Here is the link of the above program.</p>
  
  <p><a href="http://ideone.com/K1exEK" rel="nofollow">http://ideone.com/K1exEK</a></p>