title: array of strings selection sort (C)
body: <p>i compile the c code below and i have found no errrors , but when i run it the programm stops and get this error : Segmentation fault (core dumped)  . i m trying do a selection sort to an array that has one string in any row . any </p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  
  #define n 50
  
  int main() {
      int i, j, pl;  /* pl = number of words */ 
      char words[pl][n];
      char *temp;
  
      scanf("%d", &amp;pl);
      for (i = 0; i &lt; pl; i++); {
          scanf("%s", words[i]);
      }
  
      /* bla bla
         bla bla  */
  
      for (i = 0; i &lt; (pl - 1); i++) {
          pos = i;
          for (j = i + 1; j &lt; pl; j++) {
              if (strcmp(words[pos], words[j]) &gt;= 0)
                  pos = j;
          }
  
          if (pos != i) {
              strcpy(temp, words[i]);
              strcpy(words[i], words[pos]);
              strcpy(words[pos], temp);
          }
      }
  </code></pre>