Advertisement

passing arrays

Started by March 26, 2002 08:38 PM
2 comments, last by tHiSiSbOb 22 years, 11 months ago
I am making an rpg and i need help with passing the texture array that holds the textures to the function that draws them. How do i do this.
----------------------------------------------------"Plant a tree. Remove a Bush" -A bumper sticker I saw.
Could you be a bit more specific please ? Where really is your problem ? Anyway, here''s an example :


   void aFunctionWhichTakeAnArray( int * array, int size){    array[0] = 0;} const int SIZE = 100 int main( int argc, char ** argv){    int myArray[SIZE];    aFunctionWhichTakeAnArray( myArray, SIZE);}   
Advertisement
Yeah, just pass the pointer to the first element of the array and the number of elements to a void a memory-error.

An alternative way would be using the std::vector-template which you could easily pass as reference.
Visit:http://www.evildawncrew.comAll things which are worth beeing done, are worth beeing donw well.
Passing arrays sounds painful.

Alex Broadwin
A-Tronic Software & Design
-----
"if you fail in life, you were destined to fail. If you suceed in life, call me."
"The answer is out there."
"Please help, I''m using Windows!"
Alex BroadwinA-Tronic Software & Design-----"if you fail in life, you were destined to fail. If you suceed in life, call me.""The answer is out there.""Please help, I'm using Windows!"

This topic is closed to new replies.

Advertisement