Skip to content

Assignment 7 Sheqi#15

Open
Sheqi0620 wants to merge 5 commits intoCPRO-Session1:masterfrom
Sheqi0620:master
Open

Assignment 7 Sheqi#15
Sheqi0620 wants to merge 5 commits intoCPRO-Session1:masterfrom
Sheqi0620:master

Conversation

@Sheqi0620
Copy link
Copy Markdown

No description provided.

Comment thread Assignment7 Sheqi.out
@@ -0,0 +1,42 @@
Assignment 7 Sheqi Zhang

1. Explain the difference between ++*p, *p++ and *++p, if there is any.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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