Post-increment Operator and Precedence

added by KodefuGuru
5/16/2012 4:40:07 PM

4 Kicks, 224 Views

int i = 0; i = i++ + i--; Console.Write(i); What is written to the console?


2 comments

dpeterson
5/17/2012 8:46:56 AM
Nice little brain teaser, you should post more like this.

KodefuGuru
5/17/2012 5:41:28 PM
Thanks for the suggestion, I'll do that! I have another brain teaser for my upcoming post that follows up on this article for more operator fun. It's currently sitting in my review list and will be published early next week. You can make suggestions on what you would like me to write about on my Trello board (of course, DNK comments is fine as well!): https://trello.com/b/f8iNdSvZ