Store 2d array information in an integer?

I want to make an integer store the location of my array, something like this:

1
2
3
4
5
6
7
8
9
10
11
string collection[3][3] = {
		{"b","b","b"},
		{"b","b","b"},
		{"b","b","b"}
	};
	
	int topLeft = [1][1];
        collection topLeft = "a"//this should change collection to "a"
        //or alternatively
        int topLeft = collection[1][1];
        topLeft = "a"//this should change collection to "a" 


I just want it to point to the array so I can access with ease.
Or if you could do this in a class that would work too, I saw something like it a while back but can't remember where ...
Last edited on
The first method can be made with a macro - not good -
1
2
#define topLeft [1][1]
collection topLeft = "a";

The second with a pointer to string:
1
2
string *topLeft = &collection[1][1];
*topLeft = "a";

These will modify the element at position 1,1
Thank you, I probably should have learned this a while ago ...
Topic archived. No new replies allowed.