#include <iostream>
#include <algorithm>
#include <iterator>
#include <vector>
using namespace std;

int main() {
	size_t n = 10; 

    // Best would be to use vectors. These are variable sized and dynamic
	vector<int> varray(n); 
	cout<<varray.size()<<endl; 
	
	// But if you need raw arrays you can still go for:  
	int *array = new int[n];
	for (int i=0; i<n; i++)   // just filling some data 
	    varray[i]=array[i]=i*7; 
	    
	// here the solution with raw array 
	int last[5]; 
	copy(array+n-5, array+n, last);   // array version
    copy(last, last+5, ostream_iterator<int>(cout," "));   // display result in one line 
    cout<<endl; 

    // here the solution with vectors
    vector<int> vlast(5);
	copy(varray.end()-vlast.size(), varray.end(), vlast.begin()); 
	
    copy(vlast.begin(), vlast.end(), ostream_iterator<int>(cout," ")); // display
    cout<<endl; 
	return 0;
}