void setup() {
Serial.begin(9600);
char myString[] = "Hello, Arduino!";
int charCount = countCharacters(myString);
Serial.print("The string '");
Serial.print(myString);
Serial.print("' has ");
Serial.print(charCount);
Serial.println(" characters.");
}
void loop() {
// Nothing to do here
}
int countCharacters(char* str) {
int count = 0;
while (str[count] != '\0') {
count++;
}
return count;
}