title: Bubble sorting a character array
body: <p>I wrote the following code to bubble sort a character string. It's displaying garbage values.</p>
  
  <pre><code>main() {
    int n, j, k;
    char a[20], temp;
    // statements to scan the number of items (n) and the string a[n].
  
    for (j = 1; j &lt; n; j++) {
      for (k = 0; k &lt; n - j; k++) {
        if (a[k] &gt;= a[k+1]) {
          temp = a[k];
          a[k] = a[k+1];
          a[k+1] = a[k];
        }
      }
    }
    printf("The sorted items are: %s",a);
  }
  </code></pre>
  
  <p>What may be the issue?</p>