0

what is the major difference between postfix and prefix..and in what conditions do we have to use them?

11th Sep 2016, 11:35 AM
Ali Haider
Ali Haider - avatar
2 Réponses
+ 3
example of postfix int i=1,j; j=i++; cout<<j; cout<<i; here j will print 1. then i will be 1+1=2 and i will print 2 so it means ... postfix execute the expression then it increments itself example of prefix int i=1,j; j=++i; cout<<j; cout<<i; now here with prefix i increment itself 1+1=2 . then execute expression ... so j will print 2 as well as i ..... hope it will help.. :-)
11th Sep 2016, 1:59 PM
Chinmay Majumdar
Chinmay Majumdar - avatar
0
in what condition you will use these . totally depends on you
11th Sep 2016, 2:02 PM
Chinmay Majumdar
Chinmay Majumdar - avatar