title: How to refer a struct array all fields
body: <p>I am using a struct array:</p>
  
  <pre class="lang-c prettyprint-override"><code>struct person
  {
      char name[100];
      char address[100];
      char IDnumber[20];
      int  age;
  }; 
  
  struct person student[10];
  </code></pre>
  
  <p>to store data which has 4 fields. Now I want to sort them alphabetically by "name" field. </p>
  
  <p>How to refer student array to do the swap operation to swap all fields?</p>
  
  <pre class="lang-c prettyprint-override"><code>char temp;
  
  for(int r=0;r&lt;k-1;r++) {
         for(int s=r+1;r&lt;k;r++) {
  
            if(strcmp(student[r], student[s]) &gt; 0) {
              strcpy(temp,student[r]);
              strcpy(student[r],student[s]);
              strcpy(student[s],temp);
            }
         }
     }
  </code></pre>