16. WRITE A C PROGRAM PRE-INCREMENT AND PRE-DECREMENT

/*C program pre-increment and pre-decrement*/

#include<stdio.h>
#include<conio.h>
main()
{
int count = 0, loop;
loop = ++count; /* same as count = count + 1; loop = count; 
printf("loop = %d, count = %d\n", loop, count);
loop = count++; /* same as loop = count; count = count + 1; 
printf("loop = %d, count = %d\n", loop, count);
}

output

loop = 1, count = 1
loop = 1; count = 2

Comments