Question : arduino how to get array length
Answered by : glorious-gerenuk-husx87gvf489
String myString = "text"; //make a stirng
int stringLength = myString.length(); //get length from string
Source : | Last Update : Tue, 20 Oct 20
Question : length of an array arduino
Answered by : successful-sardine-3yjove3uqycz
This program prints out a text string one character at a time. Try changing the text phrase.
char myStr[] = "this is a test";
void setup() { Serial.begin(9600);
}
void loop() { for (byte i = 0; i < sizeof(myStr) - 1; i++) { Serial.print(i, DEC); Serial.print(" = "); Serial.write(myStr[i]); Serial.println(); } delay(5000); // slow down the program
}
Source : https://www.arduino.cc/reference/en/language/variables/utilities/sizeof/ | Last Update : Tue, 04 Jan 22