reset password
Author Message
jbonil34
Posts: 10
Posted 12:40 May 20, 2016 |

What does it mean by display every element of the array at an odd index and display every even element?

rcamach7
Posts: 31
Posted 13:07 May 20, 2016 |

When you look at the index, you're looking at the position of the values, rather than the elements, which are the values withing a given index.

 

So when you display the element of an odd index, you look for position/index of an array which is odd, and you display the value inside that array position/index.

On the other hand, to display every even element, you have to look at every index and check if the value is even, and if so, display it.

Last edited by rcamach7 at 13:08 May 20, 2016.
jbonil34
Posts: 10
Posted 19:14 May 21, 2016 |

Ok thank you! I totally forgot that it started from 0.