title: Comparing strings alphabetically in C
body: <p>I'm writing the compare function that will get passed to a qsort, and I'm having trouble getting the string to sort alphabetically.</p>
  
  <pre><code>typedef struct{
      char title[30];
      //other irrelevant variables
  } Album;
  
  compare(Album * l, Album * r){
  
      if(l-&gt;title &gt; r-&gt;title){
           return -1;
      }
      if(l-&gt;title == r-&gt;title){
          return 0;
      }
      else{
          return 1;
      }
  }
  
  qsort(albums, num_albums, sizeof(Album), compare);
  </code></pre>
  
  <p>I know this is probably wrong, but I'm not sure how to compare to char pointers alphabetically. Can someone help this old chap?</p>