String comparison

I can test the value of the string gCode by having it print out as G2 or G3, yet it never triggers the if function by the string comparison to "G2" or "G3".

 if (gCode =="G2") {
    dir = 0;
    Serial.println ("G2 code move");
    arc(cX, cY, endX, endY, dir); // (cX, cY, endX, endY, dir) temporary experiment
  }

  if (gCode=="G3") {
    dir = 1;
    Serial.println ("G3 code move");
    arc(cX, cY, endX, endY, dir); // (cX, cY, endX, endY, dir) temporary experiment
  }

What could I be doing wrong? The entirety of the code is too long to post.

I am getting the contents for gCode from:

strtokIndx = strtok(NULL, ",");     // get the string, perhaps G or M command
  strcpy(gCode, strtokIndx); // copy it to gCode

gCode is a C character array (as indicated by the strcpy() call to load it), and can't be used directly with "==" for comparison. Instead, you need to use strcmp()

if(strcmp(gCode,"G3") == 0){

}

Thank you!!!

How would I re-assign that string gCode to a new value?

I tried gCode ="G1";

and that certainly doesn't work.

You can use strcpy():
http://www.cplusplus.com/reference/cstring/strcpy/

I recommend you to spend a little time getting familiar with all the useful string functions:
http://www.cplusplus.com/reference/cstring/

Thank you. I have a lot to learn. I will use that resource.