Well since they're constant I didn't think it was SOO bad but, like I said up there somewhere, I make a 2d array of pointers based on the size of the screen. So they need to be constant. (Well I don't use new cuz then they wouldn't need to be, eh, they would still need to be constant to pass the 2d array to a function, unless there is a different way to do that, that I haven't found)
That's a bit trickier. Well, more like an escalation:
1 2 3 4 5 6 7 8 9 10 11 12 13
void f(int **arr,int sizex,int sizey){
//???
}
int main(){
int x=rand(); //I'm feeling wacko.
int y=rand();
int **arr=newint*[x];
for (int a=0;a<x;a++)
arr[a]=newint[y];
f(arr,x,y);
return 0;
}
Naturally, you address elements with arr[x<sizex][y<sizey].
A thing about matrices: IIRC, their physical (well, in this case the physical representation will be different. This is more of a conceptual representation) representation is
[0][0];[0][1];[0][2]; [1][0];[1][1];[1][2]; [2][0];[2][1];[2][2];
I'm still not too great with the whole pointer thing. If this makes it any worse than whats above, its a 2d array of pointers to objects =P What's so wrong with global constants anyways?
Boy, are you trying to give me an aneurysm? Haha.
If you need a matrix of pointers to objects just find and replace all instances of int (where it refers to arr! Don't try to assign a random number to a pointer, now) with name_of_class *.
Don't forget the function signature or you'll get a horribly confusing compiler error.
Huh. You've just made me use a *** for the first time.
Lol, I appreciate the help, you don't need to show me how to do the *** thing, I'll figure that out once I play with simpler ones. I'll play with that in the morning, it's just a bit late now.