#include <iostream>
using namespace std;
int main()
{
int size = 5;
//выделение памяти под одну переменную
int* value = new int;
*value = 1;
//выделение памяти под массив переменных
int* array = new int [size];
for(int i = 0; i < size; ++i)
array[i] = 42;
//выделение памяти под двумерный массив переменных
int** array2d = new int* [size];
for(int i = 0; i < size; ++i)
array2d[i] = new int [size];
for(int i = 0; i < size; ++i)
for(int j = 0; j < size; ++j)
array2d[i][j] = 42;
cout << endl;
//вывод
cout << *value << endl << endl;
for(int i = 0; i < size; ++i)
cout << array[i] << " ";
cout << endl << endl;
for(int i = 0; i < size; ++i)
{
for(int j = 0; j < size; ++j)
cout << array2d[i][j] << " ";
cout << endl;
}
//освобождение памяти
delete value;
delete [] array;
for(int i = 0; i < size; ++i)
delete [] array2d[i];
delete [] array2d;
return 0;
}
I2luY2x1ZGUgPGlvc3RyZWFtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSAKewoJaW50IHNpemUgPSA1OwoJLy/QstGL0LTQtdC70LXQvdC40LUg0L/QsNC80Y/RgtC4INC/0L7QtCDQvtC00L3RgyDQv9C10YDQtdC80LXQvdC90YPRjgoJaW50KiB2YWx1ZSA9IG5ldyBpbnQ7CgkqdmFsdWUgPSAxOwoJLy/QstGL0LTQtdC70LXQvdC40LUg0L/QsNC80Y/RgtC4INC/0L7QtCDQvNCw0YHRgdC40LIg0L/QtdGA0LXQvNC10L3QvdGL0YUKCWludCogYXJyYXkgPSBuZXcgaW50IFtzaXplXTsKCWZvcihpbnQgaSA9IDA7IGkgPCBzaXplOyArK2kpCgkJYXJyYXlbaV0gPSA0MjsKCS8v0LLRi9C00LXQu9C10L3QuNC1INC/0LDQvNGP0YLQuCDQv9C+0LQg0LTQstGD0LzQtdGA0L3Ri9C5INC80LDRgdGB0LjQsiDQv9C10YDQtdC80LXQvdC90YvRhQoJaW50KiogYXJyYXkyZCA9IG5ldyBpbnQqIFtzaXplXTsKCWZvcihpbnQgaSA9IDA7IGkgPCBzaXplOyArK2kpCgk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