For loops and accessing array elements

Okay so here is my situation, I want to be able to access the ith-1 element,ith element and ith+1 element in a array while within a for loop. It seems like i could just do something like array[i-1]... array[i] .... array[i+1] but this gives problems at the end and begin because at the beginning i-1 is not defines as well as i+1 is not defined at the end. Does anyone know a solution to this problem?
Try:
for (int i = 1; i < /* Array Size */ - 1; i ++)

You shouldn't get anymore out of bounds errors.
Topic archived. No new replies allowed.