" Given the following: &row->count Will the value (row-> count) or (& row) → count be calculated in...">

Priority of C ++ operators "&" and "->"

Given the following:

&row->count

Will the value (row-> count) or (& row) → count be calculated in C ++?

EDIT: here's a great reference for C ++ priority.

+3
source share
7 answers

In terms of priority rules, I always liked what Steve Ouallin suggested in Practical C:

There are 15 priority rules in C (& &? :). A practical programmer reduces these two:

1) Multiplication and division come before addition and subtraction.

2) Put parentheses around everything else.

+18
source

. .

: Ok . , , .

+1

, C <

→ , and, (- > )

+1

? , , , .

+1

& (row- > )

0

- > , (). , evalutated & (row- > count)

0

Source: https://habr.com/ru/post/1697744/


All Articles