The value of the expression which is used as a statement is discarded. It's the same thing that happens when you write
scanf("%d", &i);
You did know that scanf
has a return value, right? And so does ++i
in
for( int i = 0; i < 10; ++i )
And even
x = 5;
is throwing away the result of the expression.
There are lots of expressions and functions with return values that are only marginally useful. If you want to write the code in a way that makes it clear the return value is ignored intentionally and not by accident, cast to void:
(void) scanf("%d", &i);
This should silence compiler warnings about ignored return values.
These variations are also valid but a bit sillier:
(void)++i;
(void)(x = 5);