Introduction to

Easy Dynamic Memory & Smart Pointers
Solve in Playground →

Problem Statement

Include the “ header. In `main()`, read an integer, and allocate it using `std::make_unique(val)`. Dereference the smart pointer to print ‘Smart: [val]’.

Input Format

A single integer.

Output Format

Print the dereferenced value.

Constraints

C++14 or higher (std::make_unique).

Sample Input

2026

Sample Output

Smart: 2026

Explanation

Modern C++ heavily discourages raw `new` and `delete`. The `` header provides smart pointers that automatically handle deallocation.

Starter Code

#include <iostream>
// Include memory header here

int main() {
    int val;
    if (std::cin >> val) {
        // Create unique pointer and print
    }
    return 0;
}

Limits

  • Time Limit: 1s
  • Memory Limit: 256MB

Embedded C Programming

Updated: March 15, 2026
Intermediate

Embedded systems rely on efficient low-level programming to interact directly with hardware. In this course, you will learn how to write practical Embedded C programs used in real microcontroller-based systems. Rather than focusing only on theory, this course follows a practice-driven approach. Each lesson includes hands-on coding exercises that simulate real firmware development tasks used