title: error: expected unqualified-id before if
body: <p>I have looked through previous answers, but none of them have explained why I am getting this error.</p>
  
  <p>Here is my code with the error. It occurs on "if(pathID==2...)" and every if statement after that.</p>
  
  <pre><code>void add_path(int a,int b, int current_step,int pathID){
  
      if(pathID == 0){
              path[current_step] = new step(a,b,"Filled A",path[current_step]);
      }
      if(pathID == 1)
              path[current_step] = new step(a,b,"Filled B",path[current_step]);
      }
      if(pathID == 2){
              path[current_step] = new step(a,b,"Empty A",path[current_step]);
      }
      if(pathID == 3){
              path[current_step] = new step(a,b,"Empty B",path[current_step]);
      }
      if(pathID == 4){
              path[current_step] = new step(a,b,"Pour B to A",path[current_step]);
      }
      if(pathID == 5){
              path[current_step] = new step(a,b,"Pour A to B",path[current_step]);
      }
  }
  </code></pre>
  
  <p>All this code is meant to do is add to the linked list at a given position in an array. The pathID is passed in and tells it what action was performed, so we know we know what to add to the linked list.</p>
  
  <p>Later in the program I use that linked list to determine what actions were taken. I still need to make it a doubly linked list so it does not print in reverse, but that's another problem.</p>