1/5
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
How is the expression: *start++ read or parsed?
*(start++)
NOT: (*start)++
Given the following:
int x[3] = {5,10,15};
int *p = x;Evaluate *p++
Answer: 10
p points to x[0]
p++ is parsed first, so we get x[1]
*p gets the value at x[1] = 10
Given the following:
int x[3] = {5,10,15};
int *p = x;Evaluate *++p
Answer: 10
*(++p)
p points to x[0]
++p points to x[1]
*(++p) gets the value at x[1] = 10
Given the following:
int x[3] = {5,10,15};
int *p = x;Evaluate (*p)++
Answer: 6
p points to x[0]
(*p) gets the value at x[0] = 5
(*p)++ increments the value at x[0] = 6
Given the following:
int x[3] = {5,10,15};
int *p = x;After all 3 operations, what does p point to and what are the array values?
*p++
*(++p)
(*p)++
Answer: At the end of all operations, p points to x[2], and the array looks like {5, 10, 16}
*p++
p points to x[0]
p++ moves the pointer over to x[1]
*p++ gets the value at x[1] = 10
*(++p)
++p moves the pointer over to x[2] (assuming this happens after the previous step)
*(++p) gets the value at x[2] = 15
(*p)++
gets the value at x[2] = 15, increments x[2] to 16