0

I was trying to understand what a->b referred to and I was able to understand it refers to

(*a).b

where a is a pointer. What does a->b->c mean in those terms - i.e. is it (*((*a).b)).c?

3
  • thanks! so I could re-write it as i did Commented Apr 14, 2015 at 1:24
  • If you check an operator precedence chart, you'll notice the associativity (which isn't precedence, but is often on the same chart) of -> is left-to-right. This is enough to arrive at Matt's comment of a->b->c being parsed as (a->b)->c. Commented Apr 14, 2015 at 1:28
  • 2
    And it can't be a->(b->c) as (b->c) is not a member of a. Commented Apr 14, 2015 at 1:35

1 Answer 1

2

Yes, a->b->c is equivalent to (*(*a).b).c which is equivalent to (*((*a).b)).c.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.