what is the function of increment/decrement operators how many varieties do they come in how are these two varieties different from one another
WRONG ANSWER WILL BE REPORTED
Share
what is the function of increment/decrement operators how many varieties do they come in how are these two varieties different from one another
WRONG ANSWER WILL BE REPORTED
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Answer:
The increment operator, ++ adds 1 to its operand and the decrement operator -- subtract 1 from its operands. The increment/decrement operator comes in two varieties as following: (i) Prefix version and (ii) Postfix version: Prefix version Postfix version Performs the increment or decrement operation before using the value of the operand. First uses the value of the operand in evaluating the expression before incrementing or decrementing the operand’s value Example: sum = 10; ctr = 5; sum = sum + (++ctr); Example sum = 10; ctr = 5; sum = sum + (ctr++).