Results 1 to 3 of 3
Thread: Search a two Dimensional Array
- 09-13-2011, 03:25 PM #1
Member
- Join Date
- Sep 2011
- Posts
- 4
- Rep Power
- 0
- 09-13-2011, 03:44 PM #2
Re: Search a two Dimensional Array
That's not how this works. What have you tried? Please read the link in my signature on asking questions the smart way.
How would you do this by hand, without a computer?How to Ask Questions the Smart Way
Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!
- 09-13-2011, 05:06 PM #3
Re: Search a two Dimensional Array
Sorts and searches are 2 different things. If you want to search the 2d array for a value (assuming it is 'unsorted'), you need to step through each element in the 2d array and determine if it equals the value you are looking for. Let's say this is the array that you are searching:
Java Code:int[][] myArray = new int[y][x]; //Populate the array with data //Now ready to search
Use the size declarations(y,x) that you made when you allocated the array to help determine your for loop bounds.
Java Code:for(int row=0; row<y; row++){ for(int col=0; col<x; col++{ } }Last edited by sehudson; 09-13-2011 at 05:08 PM.
Similar Threads
-
Help with Two Dimensional Array
By johnjacob in forum New To JavaReplies: 2Last Post: 06-03-2011, 08:22 PM -
2 dimensional array
By sehudson in forum New To JavaReplies: 5Last Post: 02-20-2011, 11:56 PM -
2 dimensional array help!
By ber1023 in forum New To JavaReplies: 9Last Post: 01-02-2011, 12:29 AM -
Two dimensional array
By niu_niu in forum New To JavaReplies: 4Last Post: 06-13-2010, 12:34 AM -
about two dimensional array
By matin1234 in forum New To JavaReplies: 2Last Post: 06-01-2010, 11:09 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks