I have the following char array:
char* a = new char[6]{0};
Which in binary is:
00000000 00000000 00000000 00000000 00000000 00000000
I also have an integer:
int i = 123984343;
Which in binary is:
00000111 01100011 11011001 11010111
I would like to insert this 4-byte-integer i into the char array a from position [1] to position [4] so that the original array a becomes:
00000000 00000111 01100011 11011001 11010111 00000000
What is the quickest and easiest method to do that?
1101011 11011001 0110011 00000111. There are a total of at least six different possible binary representations if the integer is negative.