DEV Community

Christos Kotzias
Christos Kotzias

Posted on

C unary postfix operators

Let's say I create a variable with the name "y" that contains the value "1"

1 int y=1;

now, I write the following....

2 y=y++;

and 3 printf("%d", y); outputs "1" !!!!!!

It's like the postfix ++ operator isn't taken into account

In line 3, if the statement was x=y++; y's value would be increased to "2"

I'm straggling to understand the logic behind it ......

:(

Top comments (0)