Download presentation
Presentation is loading. Please wait.
Published bySudomo Budiaman Modified over 6 years ago
1
Then I use the monthArray and put the index/subscript/pointer in square bracketts to define the specific one that can be referenced by that name with that index. So May is monthArray[5] since it is the fifth month and July is monthArray[7] since it is the seventh month. Down here I want to access and print the element of the array that the current month is pointing to. If the user enters 3 as user_month then we will get monthArray[user_month] which will be monthArray[3].
3
This is an example of a while loop that I am going to use in my array program.
Now I am addiding a new Array - I made a mistake that we will catch in a minute - I did not leave a space between new and Array. Now I have put the 4 elements in the array.
4
I am initializing ct at 1. Then I am doing the loop while ct is less than 5. Notice that this means I will have to change ct in the loop. The other thing I will do in the array is write the deptArray with ct as the index/subscript/pointer.
6
Note that I fixed the missing space. It now reads new Array.
I used ct++ to increment ct. I could also use ct = ct + 1
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.