Combining Operators

Hey everyone, I'm really getting into learning C, but as I look at more advanced example code, I see things like

if (!*variable1) 
blah blah blah...

and

variable2 ^= *(variable1++);

my question is, when you have a combination of two operators, like !. The ! means 'not' and the * means a pointer, so for
!
variable1
does this just mean 'if not a pointer'?

For most combinations of operators do you just combine both of their literal meanings?

if(*var)

evaluates to true if the object pointed to by var is non-zero.

if(!*var)

evaluates to true if the object pointed to by var is not non-zero (i.e. is zero).

variable2 ^= *(variable1++)

sets variable2 to the exclusive or of variable2 and the value pointed to by variable1, and then increments variable1 to point to the next object in the array of objects into which variable1 points.

In your C reference look for a section that talks about operator precedence.

1 Like

I see! Thank you!