# Searching 2d array via Rows

-----------------------
int findFirstInRow(int rowNum, double value)      Search the specified row for the first occurrence of value.
When you find the first occurrence of value, return the column
number at which it is located.  If you do not find value in
the row, return -1 to indicate this.

The Question:
-----------------------
I've searched arrays before, but have no guidance on 2d arrays and specifying a specific row.  How do I approach breaking this down.  Algorithms plz.
###### Who is Participating?

Commented:
0

Commented:
A 2d array is an array of arrays, so get the array for a specific row you would use:

double[][] M = ...;   // the 2-d array
double[] row = M[rowNum];
0

Author Commented:
Wouldn't the rows and column be integers?  Where as the value in any index be a double.

Would this be specified: double[][] M = M[int rowNum][0];

0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.