FIND YOUR NEXT FEW LINES

Results for “extra”

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

301 snippets foundClear filters
C++Ordering & set operations

Sort records by two fields

C++: Tuple comparison implements lexicographic ordering across several keys.

C++✓ Tested
C++Strings

Split comma-separated text

Use getline with a delimiter to split simple C++ text.

C++✓ Tested
CStrings & byte buffers

Split simple delimited text in place

C: strtok inserts terminators into a writable buffer and skips repeated delimiter characters.

C✓ Tested
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
C++Getting Started

Store a value in a named variable

C++: Give a value a descriptive name and print it.

C++✓ Tested
CGetting Started

Store a value in a named variable

C: Give a value a descriptive name and print it.

C✓ Tested
CDynamic memory & ownership

Store a variable-length payload after a structure header

C: A flexible array member lets one allocation hold metadata and trailing bytes.

C✓ Tested
C++Containers & compound values

Store and inspect a fixed set of bits

C++: bitset offers named operations and a readable binary representation.

C++✓ Tested
CArrays

Sum array values

Iterate over a fixed C array using a size-derived element count.

C✓ Tested
CSmall algorithms & bit operations

Sum the decimal digits of an unsigned integer

C: Repeated division and remainder extract digits without converting to text.

C✓ Tested
C++Numbers & algorithms

Sum vector values

Use std::accumulate with a wide initial value.

C++✓ Tested
CDynamic memory & ownership

Swap owned buffers by swapping their pointers

C: Pointer swaps avoid copying the underlying data.

C✓ Tested