Can you explain me step wise how the decrement function is being executed?
Decrement Function
Hey Shashwat, can you please elaborate which decrement function you are talking about, or if you are talking about some particular video then please mention it’s link and time stamp also. As in general, there is no decrement function.
Hey Shashwat, as you are not responding to this thread, I am marking your doubt as Resolved for now. Re-open it if required.
Hi Shashwat, there are 2 types of decrement operators. Consider you have an int variable a:
Let me explain it with an example. In a statement such as
--a ; //or a-- ;
they will do the same thing but in the situation below
int a = 5, b, c ;
b = --a ; // Pre-decrement sends the value of a-1 first and then performs a = a - 1. Now a = 4
c = a-- ; // Post-decrement sends the value of a first and then performs a = a - 1. Now a = 3
cout << a << " " << b << " " << c ;
Output
3 4 4