[ create a new paste ] login | about

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

C++, pasted on Jun 11:
#include <string>
#include <iostream>
using namespace std;

int main()
{
	int i, j;
	double ** s_dynamic;
	double s_static[3][2];

	s_dynamic = new double *[3];
	for(i = 0; i < 3; i++)
	{
		s_dynamic[i] = new double[2];
		for(j = 0; j < 2; j++)
		{
			s_dynamic[i][j] = (1 + i)*10 + (1 + j);
			cout<<s_dynamic[i][j]<<" ";
		}
		cout<<endl;
	}

	for(i = 0; i < 3; i++)
		memcpy(s_static[i], s_dynamic[i], 2*sizeof(double));

	for(i = 0; i < 3; i++)
	{
		for(j = 0; j < 2; j++)
			cout<<s_static[i][j]<<" ";
		cout<<endl;
	}
	cin.get();
	return 0;
}


Output:
1
2
3
4
5
6
11 12 
21 22 
31 32 
11 12 
21 22 
31 32 


Create a new paste based on this one


Comments: