increment operator bug with globals?

Status
Not open for further replies.

oddson

Well-known member
Code:
int i;

void loop() {
  i=i++;
  Serial.println(i);
  delay(1000);
}
Doesn't increment.

Ard. 1.8.5/ Td1.48
 
Right. Bone-head

I knew it works with locals but that's 'cause I use correctly there.
 
What would be the reasoning behind using i=i++ as opposed to just i++? For pointers I understand the difference, but I’m lost as far as regular variables go.
 
Status
Not open for further replies.
Back
Top