
#include <cstdlib>
#include <iostream>

using namespace std;

double* funct() 
{
    
    double *mat;
    mat = new double[5];
   
    mat[0] = 3;
    mat[1] = 6;
    mat[2] = 8;
    mat[3] = 12;
    mat[4] = 13;
       
    cout << "in funct:" << endl;
    
    for (int i=0; i<5 ; i++)
        cout << mat+i << " ";
    
    cout << endl;
            
    for (int i=0; i<5 ; i++)
        cout << *(mat+i) << " ";             
        
    return mat;
}



int main()
{
    double* mat_main;

    mat_main = funct();
    
    cout << endl << "in main:" << endl;
    for (int i=0; i<5 ; i++)
        cout << mat_main+i << " ";    

    cout << endl;

    for (int i=0; i<5 ; i++)
        cout << *(mat_main+i) << " ";
    
    system("pause");
    return 0;    
} 
 
