Closed TerryTyson closed 3 years ago
That might need some minor rewriting... Naming the array in another place in your code creates a reference to the array. As soon as you try to use this, it (the reference) decays to a pointer. The original array, of course, has its own lifetime, and will keep existing.
Thanks for the feedback, @dascandy is totally right. I'll make this more clear in the revision.
In chapter 3 under the section "Pointers and Arrays" the text seems to indicate that the array itself decays. Later in the text it shows that the array itself does not decay. In my testing with Window 10/64 and also with Cygwin, the array itself is not changed. I can still access each element of the array. The pointer simply points to the first element only. (Sorry I don't have a page number, I'm reading the book online at Oreilly.com.)