I have a short integer variable called s_int that holds value = 2
unsighed short s_int = 2;
I want to copy this number to a char array to the first and second position of a char array.
Let's say we have char buffer[10];
. We want the two bytes of s_int
to be copied at buffer[0]
and buffer[1]
.
How can I do it?