跳转到主要内容
eLearner.app
C++ MEMORY LABYRINTH

C++ 内存迷宫:指针和引用

管理 C++ 中的内存分配,解决有关指针算术、智能指针 (std::unique_ptr) 和引用传递的三个实际难题。

MEMORY CONSTRAINT

实现“get_value_at_index”函数,以使用指针算术返回所需数组索引处的值(使用解引用语法 * 和加法 +)。禁止使用方括号 []。

Memory Monitor
SECURE
Array Memory Offset:
+0B
10
+4B
20
+8B
30
+12B
40
+16B
50
ptr = arr*(ptr + 3) -> 40
✓ Memory safe, zero leaks, and zero copy overheadgcc v13.2.0

Stuck?

Learn the fundamental concepts in the C++ course to solve this challenge.

Static C++ Compiler

Write valid C++ code to satisfy allocation and ownership constraints.

正在加载编辑器...