{}
62
%OFF

Stop copy pasting code you don't actually understand

Build the coding confidence you need to become a developer companies will fight for

Stop copy pasting code you don't actually understand

Become a PRO
Become a PRO
62
%OFF

Stop copy pasting code you don't actually understand

Build the coding confidence you need to become a developer companies will fight for

Stop copy pasting code you don't actually understand

Become a PRO
Become a PRO
run-icon
main.cpp
#include <iostream> #include <memory> int main() { // Create dynamic array managed by unique_ptr std::unique_ptr<int[]> arr = std::make_unique<int[]>(5); for (int i = 0; i < 5; ++i) arr[i] = i * 10; for (int i = 0; i < 5; ++i) std::cout << arr[i] << " "; std::cout << std::endl; // No need to delete[] manually — it’s automatic! }
Output