0

What is the difference between post increment and pre increment operator?

What is the output of the code... int c=2; cout<<++c; cout<<++c+c++;

20th Oct 2022, 5:58 AM
Mahendra singh
Mahendra singh - avatar
1 ответ
+ 1
The difference is: Pre incrementing increment the variable and then use it Post incrementing uses the variable and then increment it Example: c = 2; cout << ++c; cout << c; Output: 3 3 c = 2; cout << c++; cout << c; Output: 2 3 In case of cout << ++c+c++; I would advise you to read this: https://www.sololearn.com/Discuss/3095184/?ref=app
20th Oct 2022, 6:53 AM
Tomás Ribeiro
Tomás Ribeiro - avatar