FIND YOUR NEXT FEW LINES

Results for “sum”

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

75 snippets foundClear filters
CArray transformations

Find the smallest value in a nonempty array

C: Initialize from the first element instead of assuming a numeric sentinel.

C✓ Tested
Linux CommandsArchives & checksums

List files in a tar archive

Inspect the contents of a gzip-compressed tar archive without extracting any files.

tar✓ Tested
CBinary formats & structured parsing

Parse a bounded simple record with sscanf

C: A width limit protects the destination buffer and the consumed count detects trailing junk.

C✓ Tested
C++Numeric parsing & calculations

Parse a complete integer without exceptions

C++: from_chars reports both an error code and the first unconsumed character.

C++✓ Tested
Bash ScriptsArguments & decisions

Parse a small set of long options

Bash Scripts: Use a loop and case statement to consume a value-bearing long option.

Bash Scripts✓ Tested
CNumeric parsing & arithmetic

Parse an unsigned hexadecimal integer

C: Use an explicit base and check both range and full consumption.

C✓ Tested
HTMLMetadata & document links

Provide a concise page description

HTML: A description meta element summarizes a document for clients that use that metadata.

HTML✓ Tested
CSSFlexbox alignment

Push one flex item away from its siblings

CSS: An auto inline-start margin consumes remaining main-axis space.

CSS✓ Tested
CFile positioning & lifecycle

Remove one known scratch file

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

C✓ Tested
TypeScriptSafe data handling

Safely read a caught error

Check the error type before accessing its message.

unknown✓ Tested
Arduino / CSerial protocols

Search the stream for a message marker

Arduino / C: find consumes input through a matching marker or until timeout.

Arduino / C✓ Tested
PythonIteration & sequences

Take a limited number of iterator values

Python: Use islice to consume only the requested prefix of a potentially unbounded iterator.

Python✓ Tested