C
ccwork
There are two assignments here. In one assignment, p is modified. The
There is something wrong. The first assignment is "p->next = q" and
"p" is _not_ modified. After this assignment value of "p" is _not_
changed; only "p->next" is changed. The second assignemnt is "p =
p->next =q" and "p" is going to hold the result of "p->next = q",
which is "q".
Consider "b = b * 10". According to your logic it will be undefined
since b is read to determine new value but also read to determine
memory for second assignment.
prior value of p is arguably used to determine the new value stored into
p, as you explained, but it is _also_ read to determine at which memory
location the second assignment will happen, so it is not _only_ read to
determine the value stored, therefore undefined behavior.
There is something wrong. The first assignment is "p->next = q" and
"p" is _not_ modified. After this assignment value of "p" is _not_
changed; only "p->next" is changed. The second assignemnt is "p =
p->next =q" and "p" is going to hold the result of "p->next = q",
which is "q".
Consider "b = b * 10". According to your logic it will be undefined
since b is read to determine new value but also read to determine
memory for second assignment.