C
Programming and Technical
What is preincrement and post increment?
Read Solution (Total 3)
-
- in post increment after evaluating the expression,the value need to be change.
in pre increment without evaluating the expression ,the value need o be change. - 10 years agoHelpfull: Yes(0) No(0)
- preincrement := first increment then evaluate
example
int i,j,k;
i=10;
j=20
k=++i + ++j;
k=11+21=32
post increment:=first evaluate the increment
example
int i,j,k;
i=10;
j=20;
k=i++ + j++;
k=10+20=30; - 10 years agoHelpfull: Yes(0) No(0)
- ++x is pre-increment and x++ is post-increment . i.e., in the first, x is incremented before being evaluated and in the second, x is incremented after being evaluated.
Eg. • int x = 5;
• printf("x=%dn", ++x);
• printf("x=%dn", x++);
Output is 6 & 6. - 10 years agoHelpfull: Yes(0) No(0)
C Other Question