3 ms·
(&article).legs = 99 This would not work actually because it would only be modifying the copy that exists in the inner loop of the for loop. You'd be taking a
by roskilli 9y ago
(&article).legs = 99
This would not work actually because it would only be modifying the copy that exists in the inner loop of the for loop. You'd be taking a pointer to the for loop stack variable and modifying it.
If they were already references as you first mention that way simply article.legs = 99 would work yes.
- ernsheong 9y agoThanks for pointing it out.