I had to make a function that prints out all the numbers in an array (provided in 'main'), within a certain index (e.g. between 0-11, or 2-6, etc). Then the function has to return the value of the last index value.

For example, given the array 

```
{8, 3, 6, 7, 9, 5, 3, 8, 6, 7, 4, 5}

```

If I input the numbers `2` and `7`, then it should printf `{6 7 9 5 3 8}`, and then return `8. However it keeps returning`6`.

```
int index(int data[], int low, int high)
{       
    while(low <= high) {
        printf("%d\n", data[low]);
        low++;
    }

    return data[low];     
}

/* I know I could just put return[high], but i though it  
   wouldn't matter since 'low' keeps incrementing until low == high */

int main()
{       
    int activities[12] = {8, 3, 6, 7, 9, 5, 3, 8, 6, 7, 4, 5}; 
    int low, high;
    int x;

    printf("What is the starting day?  ");
    scanf("%d", &low);
    printf("What is the ending day?  ");
    scanf("%d", &high);

    x = index(activities, low, high);
    printf("\n\nThe function returns this value: %d",x);

    return 0;
}

```