📜  数组的长度 arduino - 任何代码示例

📅  最后修改于: 2022-03-11 14:55:48.337000             🧑  作者: Mango

代码示例2
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
}