Why do not the outputs of this code represent the same bytes?

void loop(){

uint64_t ABC = 1568919290685;
byte b[8];
memcpy(b,&ABC,8);

for(int i=0;i<8;i++){
Serial.println(b*);*

  • } *
    Serial.write((uint8_t*)ABC,8);
    }
    The bytes of this two outs, should be the same?
    someone explain to me why not.

From the reference:

Serial.write()

Description
Writes binary data to the serial port. This data is sent as a byte or series of bytes; to send the characters representing the digits of a number use the print() function instead.

So your loop gives you the decimal values of the bytes in your array. The write sends the binary bytes.

I know, but doing the comparison, looking at the ascii table, the values ​​don't match. It's like the position of memory is different in two cases.

Post your output.

You code is defunct, bad array reference:

void loop(){
 
  uint64_t ABC = 1568919290685;
  byte* ABCP = &ABC;
  byte b[8];
  memcpy(b,ABCP,8);
     
  for(int i=0;i<8;i++){
    Serial.print(b[i]);
    Serial.print(" = ");
    Serial.println(*ABCP);
    ABCP++; //Go to next byte
    } 

  //Serial.write((uint8_t*)ABC,8);

}

Integers may be stored “backwards” in memory depending on the compiler and/or processor architecture.

Good point. You're missing a level of indirection here:

  Serial.write((uint8_t*)ABC,8);

Should be:

  Serial.write((uint8_t*)&ABC,8);

Danois90:
Integers may be stored "backwards" in memory depending on the compiler and/or processor architecture.

The term is "Endianness".

gfvalvo:
The term is "Endianness".

Yep, but I didn't expect OP to understand that so I used the simpler explanaition! :slight_smile:

Thanks everybody, was missing '&' kkkkk :slight_smile: