FIND YOUR NEXT FEW LINES

Results for “extra”

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

301 snippets foundClear filters
CGetting Started

Read the first collection element

C: Access index zero only after establishing that the collection is nonempty.

C✓ Tested
C++Numeric parsing & calculations

Reject infinite and NaN numeric values

C++: std::isfinite excludes special floating-point values.

C++✓ Tested
CNumeric parsing & arithmetic

Reject NaN and infinite values

C: isfinite detects whether a floating-point value is an ordinary finite number.

C✓ Tested
C++Containers & compound values

Remove a map entry and inspect the number removed

C++: erase by key reports whether a unique-key map contained the entry.

C++✓ Tested
CStrings

Remove a trailing line ending

Use strcspn to terminate a C string at its first newline or carriage return.

C✓ Tested
CArray transformations

Remove adjacent duplicates from a sorted array

C: Compact equal neighbors with a write index after sorting or otherwise establishing order.

C✓ Tested
C++Collections

Remove odd values

Use the erase-remove idiom to filter a C++ vector in place.

C++✓ Tested
CArray transformations

Remove one array element and close the gap

C: memmove handles the overlap while the logical length shrinks by one.

C✓ Tested
CFile positioning & lifecycle

Remove one known scratch file

C: Check remove’s return value instead of assuming deletion succeeded.

C✓ Tested
CFile positioning & lifecycle

Rename a known file

C: The standard rename function reports failure through its return value.

C✓ Tested
C++Filesystem operations

Rename a known file through filesystem

C++: filesystem::rename reports an error by exception when the operation fails.

C++✓ Tested
C++Getting Started

Repeat a fixed number of times

C++: Use a counted loop to print three numbered steps.

C++✓ Tested