Skip to content

Documentation Error: sizeof -- see https://forum.arduino.cc/index.php?topic=383005.0 #4635

Closed
arduino/reference-en
#210
@dpharris

Description

@dpharris

On https://www.arduino.cc/en/Reference/Sizeof the following example is wrong.

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

That < should be <= or the -1 should not be there, otherwise the last element in the array is never reached.

See: [(https://forum.arduino.cc/index.php?topic=383005.0)]

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions