#include <iostream>
using namespace std;
void PrintArray(int* dinamic_arr);
int GetPoisitiveNumbers(int* array);
int main()
{
int* dynamic_var = nullptr;
int size = 0;
cin >> size;
int* dynamic_arr = new int[size] {1, 2};
int* resault_arr = GetPoisitiveNumbers;
PrintArray(dynamic_arr);
return 0;
}
void PrintArray(int* dynamic_arr)
{
int size = _msize(dynamic_arr) / sizeof(dynamic_arr[0]);
for (int i = 0; i < size; i++)
{
dynamic_arr[i] = i + 1;
cout << *(dynamic_arr + i) << " ";
}
cout << endl;
}
int GetPoisitiveNumbers(int* array)
{
int size = _msize(array) / sizeof(array[0]);
int newSize = 0;
int* NewArr = nullptr;
for (int i = 0; i < size; i++)
{
if (array[i] > -1)
++newSize;
}
NewArr = new int[newSize] {};
for (int i = 0, j = 0; i < size; i++)
{
if (array[i] > -1)
{
NewArr[j] = array[i];
++j;
}
}
return *NewArr;
}