Increment and decrement operators are very handy


Q - Increment and Decrement operators are VERY handy once you get the hang of them. Proper coding style dictates their usage. The question is, does it really matter if I use X++ or X=X+1? What are your thoughts on this. 
A - Functionally, X++ and X=X+1 are equivalent, but the ++ operator is a much better way to increment a variable. It is shorter and more succinct so it's easy to see what the code is doing at a quick glance. It is also more intuitive to fit into expressions. Consider when used in array notation: a[++i] to a[i=i+1], the first example is much easier to read. I think it should always be used over X=X+1.

Criteria - Write one or two paragraphs. Provide valuable and thoughtful feedback for the above answer with constructive criticism and critiques. Present original thoughts and ideas in postings, (avoid simple agreement or disagreement with, or restatement of other's postings) You may want to provide additional information from your outside readings or other outside resources. I encourage you to share links to other excellent resources during this course.

Request for Solution File

Ask an Expert for Answer!!
Data Structure & Algorithms: Increment and decrement operators are very handy
Reference No:- TGS0125138

Expected delivery within 24 Hours