I understand what increment and decrements operators are (++ and --) and the difference between post and pre (i++ vs ++i) but should they be avoided as they do increase the difficulty of reading the code? After reading the answers to the question Are assignments in the condition part of conditionals a bad practice? it seems like code readability is of the utmost importance. I had a prof who told us not to use increment or decrement operators unless you know exactly what you're doing (but this prof usually gave poor advice).In my opinion, i++ is easier red than i = i + 1, however I wouldn't do this in side other statements, such as arr[i++] or arr[++i], I would break these over two lines.In summaryis it ok to use ++ and -- when they are the only operations on the line?is it ok to use ++ and -- when they are combined with other operations and operator presidency has to be considered?
Do increment and decrement operators decrease readability?
java;c++;language agnostic;readability;operators