Explore Connect Documentation
Snippets
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <memory>
using namespace std;
int main() {
  int n = 10;
  // smart pointer to an array of int variables
  unique_ptr<int[]> array(new int[n]);
  for (int i=0; i<n; ++i) {
    array[i] = i;
  }
  for (int i=0; i<n; ++i) {
    cout << array[i] << ' ';
  }
  cout << endl;
  return 0;
}
Press desired key combination and then press ENTER.