[Solved] using reference in iteration of array


It certainly depends on what the body of the loop does.

With no body to the loop, both will just completely discard the entire loop.

There’s nothing different about the code that can be generated in either case. The & case-A has the most likelihood of being able to discard needless operations (like copying values). But obviously the semantics are different when it comes to modifying i.

solved using reference in iteration of array