Skip to content

Jack Rosen, Assignment 7#2

Open
jrosen081 wants to merge 3 commits intoCPRO-Session1:masterfrom
jrosen081:master
Open

Jack Rosen, Assignment 7#2
jrosen081 wants to merge 3 commits intoCPRO-Session1:masterfrom
jrosen081:master

Conversation

@jrosen081
Copy link
Copy Markdown

No description provided.

Comment thread assignment7.txt
@@ -0,0 +1,14 @@
Jack Rosen
1. ++*p increments the value at point p. *p++ increments p and then returns the value. *++p increments p and then returns the value as well.
Copy link
Copy Markdown
Contributor

@oldclesleycode oldclesleycode Jul 11, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not quite. The expression ++*p has two operators of same precedence, so compiler looks for associativity. Associativity of operators is right to left. Therefore the expression is treated as ++(*p). The expression *p++ is treated as *(p++) as the precedence of postfix ++ is higher than *. The expression *++p has two operators of same precedence, so compiler looks for associativity. Associativity of operators is right to left. Therefore the expression is treated as *(++p).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants