example3_memory_allocation.cpp

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
#include <iostream>
#include <cstdlib>

int main() {
    size_t num_elements = 1000000;
    
    int* array = new int[num_elements];
    
    // Use the array...
    
    delete[] array;
    
    return 0;
}
Back to size_t