title: Cant find my logical error in a function
body: <p>For some reason, my code is not iterating past checking for "and". Why would it not pick up the rest of my literals?</p>
  
  <p>NOTE: I am calling this function for another function. This is working fine only posting this for reference:</p>
  
  <pre><code>int readFile(FILE *file, struct assem *item) 
  {
  size_t i =0;
  //this is sort of the constructor, if you will. 
  item-&gt;counter = 0;
  //breaks down text file into line by line 
  size_t maxLines = sizeof item-&gt;myLines / sizeof *item-&gt;myLines;
  //and stores them into "myLines array"
  while(i &lt; maxLines &amp;&amp; fgets(item-&gt;myString, sizeof item-&gt;myString, file))
      {
          item-&gt;myLines[i] = strdup(item-&gt;myString);
          item-&gt;myLines2[i] = strdup(item-&gt;myString);
          i++;
          item-&gt;counter++;
      }   
  return 0;
  }
  
  int secondCheck(struct assem item)
  {
  for (int s = 0; s &lt; item.counter; s++)
      {
          //Rformat check
          if((strcmp(item.myWord[s],"add")==0)||(strcmp(item.myWord[s],"srl")==0)||
             (strcmp(item.myWord[s],"and")==0)||(strcmp(item.myWord[s],"sub")==0)||
             (strcmp(item.myWord[s],"slt")==0)||(strcmp(item.myWord[s],"nor")==0)||
             (strcmp(item.myWord[s],"sll")==0)||(strcmp(item.myWord[s],"subu")==0)||
             (strcmp(item.myWord[s],"sltu")==0)||(strcmp(item.myWord[s],"addu")==0)||
             (strcmp(item.myWord[s],"or")==0))
             {
                 checkRformat(item.myLines2[s], &amp;item);
                 printf("%s%s%s%s%s%s\n",item.opcode,item.rs,item.rt,item.rd,item.shamt,item.funct);
             }
             else{printf("Womp");}
  
      }
  
  }
  </code></pre>
  
  <p>Here is my output:</p>
  
  <pre><code>Splitting string:
  add
  $t1
  $t1
  $s6
  000000NULLNULLNULL0000010100
  </code></pre>
  
  <p>This is the part im having issues with.</p>
  
  <pre><code>void checkRformat(char *LineArray, struct assem *item)
  {
      int i = 0;
      char *str;
      char *temp;
      item-&gt;opcode = "NULL";
      item-&gt;shamt = "NULL";
      item-&gt;funct = "NULL";
      item-&gt;rs = "NULL";
      item-&gt;rt = "NULL";
      item-&gt;rd = "NULL";
  
              printf("Splitting string:\n");
              temp = strdup(LineArray);
              str = strtok(temp, " ,.-#\n\t");
      //this helper function gets called by another.It primarily serves to convert the MIPS code
      //instructions or labels into their binary values. These global variables will then concatenated
      // and be printed onto a .txt file. 
          while(str != NULL)
      {
          printf("%s\n", str);
          str = strtok(NULL, " ,.-#\n\t");
          if (!str) 
          {
              break;
          }
          if(strcmp(str, "add"))
          {
              item-&gt;opcode = "000000";
              item-&gt;shamt = "00000";
              item-&gt;funct = "10100";
          }
          else if(strcmp(str, "$t0"))
          {
              if(strcmp(item-&gt;rs, "NULL")){item-&gt;rs = "01000";}
              else if(item-&gt;rt, "NULL"){item-&gt;rt = "01000";}
              else if(item-&gt;rd,"NULL"){item-&gt;rd = "01000";}
          }
          else if(strcmp(str, "$t1"))
          {
              printf("\nSuccess\n");
              if(strcmp(item-&gt;rs,"NULL")){item-&gt;rs = "01001";}
              else if(item-&gt;rt,"NULL"){item-&gt;rt = "01001";}
              else if(item-&gt;rd,"NULL"){item-&gt;rd = "01001";}
          }
          else if(strcmp(str, "$s6"))
          {
              if(strcmp(item-&gt;rs,"NULL")){item-&gt;rs = "11110";}
              else if(item-&gt;rt,"NULL"){item-&gt;rt = "11110";}
              else if(item-&gt;rd,"NULL"){item-&gt;rd = "11110";}
          }
      }
  }
  </code></pre>