means firstly you have to find the index through (2,1,0) then you have to insert value 5 at that index .
Logic is :-
Firstly you must have to know the 3d array size suppose here is (3x2x3).
int xPosition = 2;
int yPosition = 1;
int zPosition = 0;
int indexOf1dArray = (xPosition *2*3) + ((yPosition * 3)+zPosition) ;
Using this insert the value at this index indexOf1dArray and if you have to get the value then again find index using this method and then find the value at this place.
can u explain this indexing visually please..it will help me to understand better..thanx.
ReplyDelete