FIND YOUR NEXT FEW LINES

Results for “Dynamic memory & ownership”

Small, practical examples. Search by task or narrow things down below.

64 snippets foundClear filters
C++Ownership & optional values

Store a reference in a standard container

C++: reference_wrapper preserves reference semantics while behaving like a copyable container element.

C++✓ Tested
Arduino / CEEPROM & program memory

Store and retrieve a multibyte integer

Arduino / C: put and get copy the bytes of a typed value.

Arduino / C✓ Tested
RustThreads & shared ownership

Update an atomic counter

Update an atomic counter in a complete Rust program using the standard library.

Rust✓ Tested
Arduino / CEEPROM & program memory

Validate a small stored payload with a checksum

Arduino / C: Store a checksum with the payload and reject a changed byte.

Arduino / C✓ Tested
CNumbers & memory

Allocate a zeroed array

Check calloc, use the allocation, and release it in C.

C✓ Tested
Arduino / CSerial communication

Collect a serial line in a fixed buffer

Read a short command without dynamic String allocation.

serial line✓ Tested
CNumbers & memory

Format a decimal value

Print two fractional digits with C printf.

C✓ Tested
Arduino / CArrays & embedded state

Group related readings in a struct

Arduino / C: A struct keeps a sample’s fields together without dynamic allocation.

Arduino / C✓ Tested
PythonFile operations & archives

Hash a file without reading it all at once

Python: Feed fixed-size binary chunks into SHA-256 for files larger than memory.

Python✓ Tested
Docker / ComposeNetworks & volume metadata

Label a volume with its purpose

Docker / Compose: Volume labels support explicit ownership and selection.

Docker / Compose✓ Tested
Bash ScriptsFunctions & arguments

Look up values in an associative array

Use named keys for a small in-memory configuration table.

dictionary✓ Tested
CNumbers & memory

Parse an integer with validation

Validate range and trailing characters when parsing a C integer with strtol.

C✓ Tested