[ create a new paste ] login | about

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

C++, pasted on May 7:
#include <iostream>

template <typename T, int ROW, int COL>
void foo(const T (&arr)[ROW][COL]){
	for(int i = 0; i < ROW; ++i){
		std::cout << "[ ";
		for(int j = 0; j < COL; ++j)
			std::cout  << arr[i][j] << " ";
		std::cout << "]\n"; 
	}
}

int main(){


	int arr[2][2] = 
	{
		{1, 2},
		{3, 2}
	};

	foo(arr);

	return 0;
}


Output:
1
2
[ 1 2 ]
[ 3 2 ]


Create a new paste based on this one


Comments: