Checking whether an array's dimensions are beyond its size

Say I have an Array, A[Size];

I want to call some function that will tell the value of that Array location.
Size_X is determined during runtime.

Is there a way to determine if the parameter passed to the function is beyond the scope of the array?
(I cant do it this way though, parameter > Size || parameter < Size, since I am using it in a game, and it is a sort of 2D Array!)
Not quite sure if this is what you're after, but:

1
2
	char array[size];
	int arraySize = (int) (sizeof(array)/sizeof(char));


This will find the size of the array, even if it is a 2d-array, and then you can do your checking afterwards.

Hope this was somehow informative:p

Fafner
Yeah, that can do the trick!
Thanks a lot
Topic archived. No new replies allowed.