[ create a new paste ] login | about

Link: http://codepad.org/KoeN1d9j    [ raw code | output | fork ]

C++, pasted on Mar 6:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

using namespace std;

#define matalloc(t, x, y, z) \
	x = new t*[y]; \
	for (int i = 0; i < y; i++) x[i] = new t[z];


int main()
{
	int** x;
	matalloc(int, x, 3, 3);

	x[0][0] = 2;
	x[1][2] = 4;

	cout << x[0][0] << " " << x[1][2] << endl;	
}


Output:
1
2 4


Create a new paste based on this one


Comments: