sizeof()

Maple(Arduino STM32) sizeof (*1) int struct union sizeof

sizeof(type)
sizeof(var)

sizeof 便便

1
char myStr[] = "this is a test";
int i;
void setup() {
Serial.begin(9600);
}
void loop() {
for (i = 0; i < sizeof(myStr) - 1; i++) {
Serial.print(i, DEC);
Serial.print(" = ");
Serial.println(myStr[i], BYTE);
}
}

sizeof int for
for (i = 0; i < (sizeof(myInts)/sizeof(int)) - 1; i++) {
// do something with myInts[i]
}

*1: sizeof char MapleC ++ char 8= 1 C ++ char 8

License and Attribution: Portions of this page were adapted from the Arduino Reference Documentation, which is released under a Creative Commons Attribution-ShareAlike 3.0 License.
leafLabs, LLC.