Blog Moved

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

Search This Blog

21 Jul 2012

c program for pre-increment and post-increment

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

PROGRAM:
#include<stdio.h>
main()
{
 int i=10,j;
 j=i++; /* j value 10 , i value 11*/
 /*post increment*/
 printf("\n After post-increment: j value:  %d , i value: %d \n",j,i);
 j=++i; /* j value 12, i value 12*/
 /*pre-increment*/
 printf("\n After pre-increment: j value: %d, i value : %d \n",j,i);

 return(0);
}

Output: ( using GNU GCC Compiler with Code Blocks IDE )
After post-increment: j value: 10 , i value:11
After pre-increment: j value: 12, i value:12

2 comments:

  1. Excellent use of coding regarding pre-increment and post increment written in C programming. This shows that he is expert in writing coding in c -program. I like this work.

    ReplyDelete