associativity

M

Mantorok Redgormor

Which section(s) in the standard describe associativity rules?

e.g., *ptr++

* and ++ are the same precedence wise and as such
will be evaluated left-to-right?
 
B

Ben Pfaff

Which section(s) in the standard describe associativity rules?

e.g., *ptr++

* and ++ are the same precedence wise and as such
will be evaluated left-to-right?

Precedence and associativity are implicit in the C grammar, which
is scattered through section 6.5 "Expressions" (in C99). You can
also find the grammar rules gathered together (non-normatively)
in Annex A.
 
B

Barry Schwarz

Which section(s) in the standard describe associativity rules?

e.g., *ptr++

* and ++ are the same precedence wise and as such
will be evaluated left-to-right?

While you are correct that * and ++ have the same precedence, the
associate right to left so the expression will be parsed as *(ptr++)
and not as (*ptr)++.


<<Remove the del for email>>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top