Skip to content

Commit

Permalink
comment out toArray in example file
Browse files Browse the repository at this point in the history
  • Loading branch information
nkaaf committed Oct 29, 2023
1 parent 006c182 commit 7b12216
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions examples/List/UtilsAndHelper/UtilsAndHelper.ino
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,18 @@ void setup() {
Serial.println("Inserted another element");

// Convert list to array
int *array = list.toArray();
// Print every element from the new array
Serial.print("The list contains the following values which are get by converting the list to an array: [");
for (int i = 0; i < list.getSize(); ++i) {
Serial.print(array[i]);
if (i != list.getSize() - 1) { // only add the ',' if the element is not the last; otherwise the output would be: [2,2,]; but now it is [2,2]
Serial.print(",");
}
}
Serial.println("]");
// free memory space generated by toArray(), because it is not used anymore
free(array);
//int *array = list.toArray();
//// Print every element from the new array
//Serial.print("The list contains the following values which are get by converting the list to an array: [");
//for (int i = 0; i < list.getSize(); ++i) {
// Serial.print(array[i]);
// if (i != list.getSize() - 1) { // only add the ',' if the element is not the last; otherwise the output would be: [2,2,]; but now it is [2,2]
// Serial.print(",");
// }
//}
//Serial.println("]");
//// free memory space generated by toArray(), because it is not used anymore
//free(array);

Serial.println();

Expand Down

0 comments on commit 7b12216

Please sign in to comment.