Go to your University || Python Lab || DSA Lab || AI & Machine Learning Lab || Linux Lab || OOPs Lab || DBMS Lab || JAVA Lab ||| Free Online Tutorials ||| 
companies for Campus Placement || Logical Reasoning || Quantitative Aptitude || General English || Technical-MCQ and Interview Questions || HR Interview Questions
0 like 0 dislike
9 views
in Tutorial & Interview questions by Goeduhub's Expert (7.8k points)
The increment and decrement operators exist in prefix and postfix form.

1 Answer

0 like 0 dislike
by Goeduhub's Expert (7.8k points)
 
Best answer
The increment and decrement operators exist in prefix and postfix form.

int a = 1;

int b = 1;

int tmp = 0;

tmp = ++a;        /* increments a by one, and returns new value; a == 2, tmp == 2  */

tmp = a++;        /* increments a by one, but returns old value; a == 3, tmp == 2 */

tmp = --b;        /* decrements b by one, and returns new value; b == 0, tmp == 0 */

tmp = b--;        /* decrements b by one, but returns old value; b == -1, tmp == 0 */

Note that arithmetic operations do not introduce sequence points, so certain expressions with ++ or -- operators may introduce undefined behaviour.

Related questions

0 like 0 dislike
1 answer 7 views
0 like 0 dislike
1 answer 4 views
0 like 0 dislike
0 answers 14 views
0 like 0 dislike
1 answer 9 views
0 like 0 dislike
1 answer 4 views
  Realize your learning potential with courses starting at ₹ 420
 Placements:   List of companies | Logical Reasoning Questions | Quantitative Aptitude Questions | General English Questions | Technical-MCQ and Interview Questions
 Online Free Training:  MACHINE LEARNINGPython Programming | Database Management System(DBMS) | Object Oriented Programming(OOPs) using C++ | Data Structures and Algorithms(DSA) | Java Programming | Linux/Unix | C Programming
Exams: List of Exams After Graduation | List of Engineering Entrance Examinations (UG/PG) | JEE Main | JEE Advanced | GATE | IES | ISROList of PSUs
 Download Previous Year Papers For:  GATE | IES | RAJASTHAN TECHNICAL UNIVERSITY (RTU-Kota)RPSC Technical Exams | ISRO
 Goeduhub
About Us | Contact Us   Social::   |  | 
...