So, I have some code like:
char* t2 = strtok(NULL, " \t\n,");
char regN[3];
strcpy(regN, t2);
Register* rt = getRegister(regN);
I checked several times the value of regN
by printing is $t0
but the function returns NULL
.
However when I tried getRegister("$t0")
it returns the correct value.
The only reason I can think for this is if strtok()
returns something other than the predicted value. Yes, the next token is $t0
. I checked this as well.
Any suggestions or ideas what is going wrong here?