Blog Moved

This website completely moved to new domain. For latest content, visit

Search This Blog

22 Jul 2012

C Program for pre decrement and post decrement

c program for understanding the concept of pre decrement and post decrement

 int i=10,j;
 j=i--;          /* j value 10 , i value 11*/
 /*post decrement*/
 printf("\n After post-decrement: j value: %d , i value:%d \n",j,i);
 j=--i;         /* j value 12, i value 12*/
 printf("\n After pre-decrement: j value: %d, i value:%d \n",j,i);


Output( using GNU GCC Compiler with Code Blocks IDE )
 After post-decrement: j value: 10 , i value: 9
 After pre-decrement: j value: 8, i value: 8

1 comment: