Post Reply 
monic part 5: writing C programs on the calculator
02-15-2021, 11:00 PM
Post: #14
RE: monic part 5: writing C programs on the calculator
(02-14-2021 11:40 AM)F-73P Wrote:  I've added "++" and "--" to the grammar

Just make sure you used the correct associativity and precedence for the post and pre increment and decrement operators. The post increment and decrement operators ( eg. "x++" and "x--" ) are one level of operator precedence up from the pre increment and decrement operators and they're also left associative. For the lower precedence pre increment and decrement operators ( eg. "++x" and "--x" ) note they're right associative. Furthermore, you have to take into account the differences between the two classes of post and pre increment and decrement operators with respect to how they alter an expression. What I mean is that something like "y = x++" will assign x to y and then increment x whereas "y = ++x" will increment x first and then assign it to y. You should consult the C99 grammar which can be found here ( Look in Annex A ). If you already know all of this, then please don't interpret my comments as patronizing you in any way, I just like to be sure Smile

Regards,

Jonathan

Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: monic part 5: writing C programs on the calculator - Jonathan Busby - 02-15-2021 11:00 PM



User(s) browsing this thread: 2 Guest(s)