Array say that it is 24 spaces but when printed is much longer

Hey everyone.

So i've been working on a project for school.
right now i'm trying to get an array out of a full array.
the problem is that every time i print the size of the array it says it's 24 characters but when i print the array it is much longer.
the array i am trying to get after the split is is

01 01 01 01 01 01 01 01

that i am getting from the array

01 0F 01 01 01 01 01 01 01 01 01 01 01 04 01

so my code seems oke but when i split the string i get

01 01 01 01 01 01 01 01 01 0F 01 01 01 01 01 01 01 01 01 01 01 04 01

so that is the right string plus the original string so thats already weird but when try to print the size of the array it says its only 24 characters while it is clearly more.

here is my code

void Get_Data_Bytes(String message_That_Was_Recieved){
  int length_Of_String;
  byte amount_Of_Data_Bytes;
  //the places that the data takes up in the main string
  int amount_Of_Data_Places;

  //transform the string into an array so that we can easily split the string into smaller parts
  length_Of_String = message_That_Was_Recieved.length() + 1;
  char message_That_Was_Recieved_Array[length_Of_String];
  message_That_Was_Recieved.toCharArray(message_That_Was_Recieved_Array, length_Of_String);

  //the standard message is 7 bytes + the data bytes so lets see how many data there is
  amount_Of_Data_Bytes = Message_As_Struct.Packet_Lenght - 7;
  amount_Of_Data_Places = amount_Of_Data_Bytes * 3;
  char data_Array[amount_Of_Data_Places];
  char data[amount_Of_Data_Bytes];
  for (int i = 0; i < amount_Of_Data_Places; i++){
    data_Array[i] = message_That_Was_Recieved_Array[9+i];
  }

    Serial.println("end");
      Serial.println(data_Array);
      Serial.println("hello");
  

}

can anyone see why the array is so long while it shoudn't be?

Please take a few minutes and write a small, complete and executable program that isolates the matter you are seeking help on.

Your problem could be one of dozens of things. Many in portions of your program you did not share. Maybe.

The tiny amount of code is nearly useless, I fear in a large context it would be bewildering, therefor my request to make a small demonstration program.

a7

Could it be that multiplication operator?

Seems like the array is printed as 24 hexadecimal values which adds up.

If i make the multiplicator smaller it doesn't contain the full message i want only part of it

any way i count it doesn't add up, can you tell how you looked at it so i can see?

Why don’t you tell us how you looked at it so we can see? What are you talking about?

a7

If the message is 8 bytes long, then "data_array" will be 24 bytes long (amount_Of_Data_Bytes * 3), the "data_array" is not properly initialized, indicies from offset 9 to 9+amount_Of_Data_Places are getting a value, the rest is not. When you "Serial.println(data_array)" it will print 24 space separated hex-values since "data_array" is NOT an array of ASCII values.

All in all the code makes little sense, "Message_As_Struct"?