Skip to main content
gamedev.net
🔒 Locked

2 dimensional array...

Started by chris1234 Nov 27, 2001 at 4:22 PM 1 replies 400+ views
Original Post
chris1234
chris1234
I need to pass a 2 dimensional array to an function which then operates on it as if it were an array and then returns the array it''s 4x4 matrix (not used for 3D) how do I do that ''cause I forgot and I can''t seem to find any info on it anywhere remember it was something as in int **pointer; ant then for every row you had to use malloc/int to or something... Chris
Vlion
Vlion
If im not mistaken...

int array[2][2];

int* func(int a[2][2])
{
//operate
return &a // ???? *a, &a, or a/
}

I came, I saw, I got programmers block.
~V''''lion
~V'lionBugle4d
chris1234
chris1234
Thanks Vlion!

Wonder where my mind was...so obvious....but still even though I don''t need it I wonder how to get a pointer point to a 2 dimensional array

I know I can just do it like this:
int *p[4];
but then p is just an array of pointers each pointing to a single row of my 4 x 4 array...how do I let 1 pointer (**p) point to the entire array....?

Chris

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.