How to access Array Elements when working with loops?

How can we access the array elements? I am working on loops but there is a problem in the code, every time I have to initialize “I” to the next value when I want to store any value in the array. Is it right way to assign values to an array? Int marks[5]; Int i=1; Marks[i]=5; i=2; Marks[i]=4; If yes then tell me how can I access the values from the array when I want to display the value of specific index?
