As others have explained, the posted code contains undefined behavior and, as such, is meaningless.
So let's assume you changed your question to...
Can you please tell me what is 0.5++? Is it 1.0 or 1.5 and also why?
Neither: 0.5++
is not valid C code.
C99 §6.5.2.4 Constraints: 1. The operand of the postfix increment [...] shall be a modifiable lvalue.
This means it must be something where a value can be stored. 0.5
is a constant and can't be modified.
If you again change your question to:
float x = 0.5;
printf("%f\n", x++);
What's the printed value?
... then we're finally down to proper C. The value printed would be "0.500000
", as the result of the postfix operator is the value before the increment.
The new value of x is 1.5
. See
C99 §6.5.2.4 Semantics: 2. The result of the postfix ++ operator is the value of the operand. As a side effect, the value of the operand object is incremented (that is, the value 1 of the appropriate type is added to it).