title: Recursive Bubble Sort in C
body: <p>I am unable to find the error in the silly recursive bubble-sort code below. Could somebody tell why it is not working correctly? Thanks in advance.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int b[8] = { -9, 9, 89, 78, 56, 45, 34, 89 };
  
  void print(int n)
  {
      int i; 
  
      for (i = 0; i &lt; n; i++)
          printf("%d\t", b[i]);
  
      printf("\n");
  }
  
  void rb(int n)
  {
      if(n == 0) 
          return;
  
      int i, j;
      for (i = 0; i &lt; n - 1; i++) {
          if (b[i + 1] &gt; b[i])
              j = b[i + 1];
  
          b[i + 1] = b[i];
          b[i] = j;
      }
  
      rb(n - 1);
  }
  
  int main()
  {
      print(8); 
      rb(8); 
      print(8); 
  
      return 0;
  }
  </code></pre>