What does "++" and "--" mean?

I'm working on modifying some existing code to better suite my needs, plus, it's a great way to learn. I've been doing pretty well working through it myself with the help of Google, but I've had trouble figuring out what two functions do. The relevant code is:

ISR(PCINT2_vect) { * if (TACH_B_PORT & _BV(TACH_B_PIN))* * {* * tValue++;* * }* * else* * {* * tValue--;* * }* }

The two functions I haven't been able to figure out are "++" and "--". Could someone please explain what exactly they do?

the first one increments by one, the second one decrements by one.

yippee - I've finally managed to answer a question on this forum!

Fulliautomatix: the first one increments by one, the second one decrements by one.

yippee - I've finally managed to answer a question on this forum!

That's worthy of a karma++

Fulliautomatix: the first one increments by one, the second one decrements by one.

yippee - I've finally managed to answer a question on this forum!

Well done. Karma awarded, but there is slightly more to it than that. The OP did not ask but will surely want to know the difference between tValue++; and ++tValue; at some time. So, for another karma point explain the difference. Everybody else please keep the answer to yourself. :)

Given your examples, a naked statement with the semi colon added, there is no difference, and I would not be surprised if the compiler did not emit the exact same code.

difference between tValue++; and ++tValue; at some time. So, for another karma point explain the difference.

The double plus before hand means increment the value before it's evaluated, the double plus afterwards means evaluate and then increment. (probably not expressed this in proper 'C' terminology. sorry!)

cheers