2D Array index look up.

Is there a way to find the location of the data in a 2D array, if you know the information.

for example:

0 1 2 3 4 5
0 a b c d e f
1 z x y w v u



If I want to see if 'c' is in the array and return it location of [0][3]?

You would need to just store each index and assign the value after the comparison has been made.
I guess, I'm not sure what you are say. I would like to search array for "c" and return the Location [0][3].

If I search how do I return the value?



1
2
3
4
5
6
7
8
9
10
11
12
13
14
#include <iostream>
#include <iomanip>
using namespace std;

int main()
{
	char array [2][5] = {{"a", "b", "c", "d", "e"},
                              {"Z", "y", "X", "w", "v", "u"}};
	


	
	return 0;
}
Last edited on
Topic archived. No new replies allowed.