0

As the title suggests i'm trying to read a value stored in an array of strings in C, but whenever i print that value, it will print every other value after that.

if(len == 2){
      if(instruction[0] >> 4 == 6){
        char sixes[][4] = {"addl", "subl", "andl", "xorl"};
        int x = instruction[0] & 0xf;
        printf("%s\n", sixes[x]);
        continue;
      }

considering this is identical to what tutorials say to do im at a loss

the expected outcome would be addl andl subl xorl

what i keep getting is addlsublandlxorl andlxorl sublandlxorl xorl

ive checked that the pointer is correct and it is, im so confused

Noseph
  • 1

0 Answers0