Order of operations in C. ++ vs |=, which occurs first?

c, operator-precedence

Solution

The ++ is applied on the pointer `d`, not on the lvalue that is being assigned to, `*d`.

If you really want to, you can think of it like this:

- The value of `b` is bitwise-AND:ed with the constant `0x0f`

- The resulting bit pattern is bitwise-OR:ed into the value that `d` points at.

- The pointer `d` is incremented to point at the next value.

Problem

I have the following code that I'm reading through: ``` if( (i%2) == 0 ){ *d = ((b & 0x0F) << 4); } else{ *d++ |= (b & 0x0F); }; ``` I'm looking specifically at the `else` statement and wondering in what order this occurs? I don't have a regular C compiler, so I can't test this. When we are performing `*d++ |= (b & 0x0F);`, what order does this occur in?

Original source