7.5 Arrays, Records, Pointers
7.5 Arrays, Records, Pointers
LOC(LA[K]) =
Base(LA) + w(K – lower bound)
LOC(LA[16]) = 200 + 2(16 – 1) = 230
Algorithm: (Traversing a Linear Array) This algorithm traverses a linear array LA with
LB and UB.
1. Repeat for K = LB to UB
Apply PROCESS to LA[K]
[End of Loop]
2. Exit