A struct node
containing {... char opcode_CHAR[6]; }
a pointer declared struct node *pointer2
pointing to a node of that struct kind;
got a char temp_array[6]
.
j = 6 - sizeof(temp_array);
So depending on the sizeof(temp_array)
,
I will copy to a certain index j
of opcode_CHAR
.
If sizeof(temp_array) == 4
ill copy to opcode_CHAR
starting with j = 2;
If sizeof(temp_array) == 2
ill copy to opcode_CHAR
starting with j = 4;
etc...)
I am getting a compilation warning:
warning: passing argument 1 of 'strcmp' makes pointer from integer without a cast [-Wint-conversion]
because of this: strcpy(pointer2->opcode_CHAR[j], temp_array);
I tried pointer2->opcode_CHAR = pointer2->opcode_CHAR[j];
before the strcpy(pointer2->opcode_CHAR, temp_array);
so that it points to the index j
that I want, instead of the start of the array. But it did not work.
should I just add j
like this? strcpy(pointer2->opcode_CHAR+j, temp_array);