"shan" <> wrote in message
news: oups.com...
> Hi to everybody,
>
> I am begginer in C programming language.
> My simple doubt is the difference between postfix & prefix unary
> operator plus.
> (i.e) i++ and ++i .
>
> plz give me an example program with output.
The value of a prefix increment expression is the
value after the increment.
The value of a postfix increment expression is the
value before the increment.
#include <stdio.h>
int main()
{
int pre = 1;
int post = 1;
/* prints 2 1 */
printf("++pre == %d post++ == %d\n", ++pre, post++);
/* prints 2 2 */
printf(" pre == %d post == %d\n", pre, post);
return 0;
}
This is very fundamental C. Which texbook(s) are you
reading which don't explain this?
-Mike
|