Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

i++ and++i

#include <stdio.h>
int main() {
   int i=5,j;
   j=i++;
   printf ("
after postfix increment i=%d j=%d", i,j);
   i=5;
   j=++i;
   printf ("
 after prefix increment i=%d j=%d",i,j);
   return 0;
}
//output:
//after postfix increment i=6 j=5
// after prefix increment i=6 j=6
Source by www.tutorialspoint.com #
 
PREVIOUS NEXT
Tagged:
ADD COMMENT
Topic
Name
6+9 =