Results for “extra”
Small, practical examples. Search by task or narrow things down below.
Read the first collection element
C: Access index zero only after establishing that the collection is nonempty.
C✓ Tested
Reject infinite and NaN numeric values
C++: std::isfinite excludes special floating-point values.
C++✓ Tested
Reject NaN and infinite values
C: isfinite detects whether a floating-point value is an ordinary finite number.
C✓ Tested
Remove a map entry and inspect the number removed
C++: erase by key reports whether a unique-key map contained the entry.
C++✓ Tested
Remove a trailing line ending
Use strcspn to terminate a C string at its first newline or carriage return.
C✓ Tested
Remove adjacent duplicates from a sorted array
C: Compact equal neighbors with a write index after sorting or otherwise establishing order.
C✓ Tested
Remove odd values
Use the erase-remove idiom to filter a C++ vector in place.
C++✓ Tested
Remove one array element and close the gap
C: memmove handles the overlap while the logical length shrinks by one.
C✓ Tested
Remove one known scratch file
C: Check remove’s return value instead of assuming deletion succeeded.
C✓ Tested
Rename a known file
C: The standard rename function reports failure through its return value.
C✓ Tested
Rename a known file through filesystem
C++: filesystem::rename reports an error by exception when the operation fails.
C++✓ Tested
Repeat a fixed number of times
C++: Use a counted loop to print three numbered steps.
C++✓ Tested