Maybe it should have 6 bytes (maybe not), but how many bytes are actually allocated by your declaration ?
Why do you think that you need to use itoa() to convert the ints to ASCII in order to send the data somewhere ? Why not simply put the ints in an array and use Serial.write() to send the entire array at once ?
Nearly. It will have '1', '2', '3' in the first 3 bytes of the array and will also have '\0' in buffer[3], which marks the end of the string and should not be ignored. Note too that the values are chars so will not be 1, 2 and 3
However, an int (on most Arduinos) consists of 2 bytes so you could send 123 as 2 bytes instead of 4 if you did it correctly. You also need to take into account than an int variable can have a negative value whereas an unsigned int can't
First, your serial output will not work unless you do a Serial.begin() in setup(). Second, 4 characters is not near enough space for some of the conversions you are doing. Here are the results of those conversions:
RINT0: a
RINT1: ffffff9c
RINT2: 12c
RINT3: 258
RINT4: ffffd8f0
RINT5: 55f0
RINT6: 69
RINT7: 1e
You must have room for all the characters AND the null terminator.
I see, i don't want to have 4 characters but 4 bytes for each variable, the message that i'm trying to form should be like this as i declare it packet_ret[36]={1,36,0,checksum,RINT0 ,RINT1,RINT2,RINT3,RINT4,RINT5,RINT6,RINT7 } ;
i'm sorry if i couldn't write clearly what is the issue.
So you need to transmit the values in binary? A great example of why we needed to see the entire script.
You just need to copy the values into the array (this is assuming the receiver of the data uses the same data "endianness" as you). The Arduino UNO is, by default, little endian. If your receiver is little endian as well you can just copy the values into the array.