+ 1
Can we access the elements of array outside the for loop? Please give reason also.
3 Answers
+ 2
If you have initialized the variable before the loop then you can use it outside loop
&
&
if you have initialized it inside loop you cannot use it outside the loop
+ 1
as long as the array wasn't declared and defined in the for loop, you can access the elements outside the for loop by using the index of the element. for example, arr[index]
- 1
yes using :: this operator