really simple array

how do you create a function that passes in an array by value and the subscript and returns the value of the array at that subscript.
What, specifically, are you having trouble with?
1
2
3
4
5
6
7
8
9
10
11
12

/*    Assuming the array contains integers:    */


int getAt( int Array[], int subscript )
    {
    return Array[ subscript ];

    }
        /*    getAt()    */



NOTE: This is a very dangerous function! The variable subscript could reference to a position outside of the bounds of the array! This function doesn't know the dimensions of the array.
Topic archived. No new replies allowed.