| ▲ | trealira 12 hours ago | |
They admitted it was a trick question. I just don't think it would have been written as they wrote it by anyone who knew C++ to a decent level in the first place. Maybe that makes it a stumbling block as you're learning it, but it seems obvious to do the simplest thing first, at least in my view. (Also, this is at least in part inherited from C. Dangling pointers themselves are due to C. And temporary expressions are just acting consistently with C semantics here.) | ||