hi can someone help how to make a program or exampel of program using two dimensional array. Or can someone help me to make program by this problem >Write a program using two dimensional array that searches a number and display the of times it occurs on the list of twelve input value.
I'm asking for help coz my Prof. didn't explain it very well

Comments
Read more and write some codes.

Greetings,

Using a 2-Dimensional array isn't very difficult at all. In fact for simplicity, lets take a look how a 2-Dimensional array looks in all aspects.

int myValue[2][3];

We know this array is going to be a 2x3 rectangle. So lets see how this looks:

Rows/Columns	Column 0	Column 1	Column 2	Column 3
Row 0		myValue[0][0]	myValue[0][1]	myValue[0][2]	myValue[0][3]
Row 1		myValue[1][0]	myValue[1][1]	myValue[1][2]	myValue[1][3]

Not bad at all. How about if we initialize this array:

int myValue[2][3] = { {5, -3, 0}, {10, 17, -25} };

There are two blocks, with 3 numbers inside each initializing our 2x3 array completlely:

Rows/Columns	Column 0	Column 1	Column 2
Row 0		5		-3		0
Row 1		10		17		-25

This should all be making sense. To set your array's data outside of the initilization isn't hard at all:

int main() {
	int myValue[2][3]

	myValue[0][0] = 5;
	myValue[0][1] = -3;
	myValue[0][2] = 0;

	myValue[1][0] = 10;
	myValue[1][1] = 17;
	myValue[1][2] = -25;

	return 0;
}

So think of a 2-Dimensional array as a rectangle. Rows and Columns, right and down. Once you have this down, please feel free to ask more questions.


- Stack Overflow

nice , but dont forget to close array initialisations with a

;

ching ching

Edited 5 Years Ago by gruffy321: n/a

This article has been dead for over six months. Start a new discussion instead.