How can i pass in an array with a value?

Hey guys, how exactly can i pass an array with a value into a function. Etc
1
2
3
4
void MyFunction(SDL_Rect *pCamera, SDL_Rect tile[tiletype])
{

}


Is anything like that possible?
I dont see the meaning of the above code, however you could use a pointer to the array:
1
2
3
4
5
6
7
8
9
10
int myArray[10];
int* myPointer;
myPointer=myArray;
/*

*(myPointer)==myArray[0]
*(myPointer+1)==myArray[1]
etc..

*/
Last edited on
Heh, yes i think i can say i'm to tired now.. heh i dont know how i didnt think of that. Cheers :D
Um... myArray is already a pointer. The prototype would be
void MyFunction(SDL_Rect *pCamera, SDL_Rect *tile,int tiletype);
I think this should work:
void MyFunction(SDL_Rect *pCamera, SDL_Rect tile[]);
If you want to get the number of elements, use sizeof(title)/sizeof(SDL_Rect)
Topic archived. No new replies allowed.