0
what is the major difference between postfix and prefix..and in what conditions do we have to use them?
2 odpowiedzi
+ 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.. :-)
0
in what condition you will use these . totally depends on you