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?