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

Repeat a fixed number of times

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

C✓ Tested
C++Getting Started

Repeat while a condition holds

C++: Count down while a positive number remains, updating the loop variable on each iteration.

C++✓ Tested
CGetting Started

Repeat while a condition holds

C: Count down while a positive number remains, updating the loop variable on each iteration.

C✓ Tested
CFile positioning & lifecycle

Replace bytes at a known position in a binary file

C: Open in update mode and seek before writing a fixed-size replacement.

C✓ Tested
C++Getting Started

Replace one collection element

C++: Update an existing element at a known valid index.

C++✓ Tested
CGetting Started

Replace one collection element

C: Update an existing element at a known valid index.

C✓ Tested
C++Text validation & parsing

Replace text using captured regex groups

C++: Numbered replacement groups can rearrange a known two-part name.

C++✓ Tested
C++Strings

Replace the first match

Find and replace one literal substring in C++.

C++✓ Tested
CStructures & function interfaces

Represent a small set of named states

C: An enum gives symbolic names to integer state values.

C✓ Tested
C++Ownership & optional values

Represent an absent result with optional

C++: value_or supplies a default without requiring a sentinel inside the value domain.

C++✓ Tested
C++Getting Started

Require two conditions to be true

C++: Combine a lower and an upper bound to check whether a value is in range.

C++✓ Tested
CGetting Started

Require two conditions to be true

C: Combine a lower and an upper bound to check whether a value is in range.

C✓ Tested