title: How do you swap elements of a struct array in c?
body: <p>I've seen the couple other question regarding this topic, but none of the answers have worked for me. </p>
  
  <p>My swapClasses method follows:</p>
  
  <pre><code>void swapClasses(struct ClassInfo *p1, struct ClassInfo *p2){
      ClassInfo *temp = p1;
  
      *p1 = *p2;
      *p2 = *temp;
  }
  </code></pre>
  
  <p>But when I execute the code and attempt to add a class that should technically appear first in the array, it is just added to the end. No swapping takes place even though I know that portion of the code executes (tested with a simple print statement). I believe there is something wrong with the way I'm using pointers. Can anyone advise?</p>