title: Why am not getting any output for this program to bubble sort an array using recursion?
body: <p>What I tried doing is to run the process of sorting <code>(n-1)</code> times and hence             that <code>if else</code> condition in the main function. Since we have to use recursion I have used the <code>if else</code> ladder inside the user defined function.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  int bin (int a[]);
  
  int n, i, a[100], j = 0, temp, count = 0;
  
  int main ()
  {
      printf ("enter the number of elements\n");
      scanf ("%d", &amp;n);
  
      printf ("enter the array elements\n");
      for (i = 0; i &lt; n; i++)
          scanf ("%d", &amp;a[i]);
  
      bin (a);
      if (count == n - 1)
      {
          for (i = 0; i &lt; n; i++)
          {
              printf ("%d", a[i]);
          }
          return 0;
      }
      else
      {
          j = 0;
          bin (a);
      }
  }
  
  int bin (int a[])
  {
      if (j != n - 1 &amp;&amp; a[j] &gt; a[j + 1])
      {
          temp = a[j];
          a[j] = a[j + 1];
          a[j + 1] = temp;
          j++;
          bin (a);
      }
      else if (j != n - 1 &amp;&amp; a[j] &lt; a[j + 1])
      {
          j = j + 1;
          bin (a);
      }
      else
      {
          count++;
          return 0;
      }
  }
  </code></pre>