FIND YOUR NEXT FEW LINES

Results for “struct”

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

152 snippets foundClear filters
CBinary formats & structured parsing

Format a known timestamp in UTC

C: gmtime converts to UTC calendar fields and strftime formats them.

C✓ Tested
CBinary formats & structured parsing

Format a nonnegative integer amount as whole and fractional units

C: Keep the calculation in integer minor units and use two digits for the remainder.

C✓ Tested
JavaScriptArray restructuring

Generate a bounded integer range

JavaScript: Array.from supplies each output position to its mapping function.

JavaScript✓ Tested
TypeScriptArray restructuring

Generate a bounded integer range

TypeScript: Array.from supplies each output position to its mapping function.

TypeScript✓ Tested
CStructures & function interfaces

Give a reusable record type a short name

C: A typedef names a structure type without changing its representation.

C✓ Tested
HTMLAccessible structure

Give a section an accessible region name

HTML: A section becomes a named landmark when its heading is referenced with aria-labelledby.

HTML✓ Tested
PowerShellStructured formats & encodings

Handle a malformed JSON document

PowerShell: ConvertFrom-Json reports a terminating conversion error under the selected error preference.

PowerShell✓ Tested
PythonStructured data & serialization

Handle malformed JSON input

Python: Catch JSONDecodeError without hiding unrelated programming errors.

Python✓ Tested
HTMLAccessible structure

Identify a search region with the search element

HTML: The native search element exposes a search landmark in supporting browsers.

HTML✓ Tested
HTMLAccessible structure

Identify the current page in a breadcrumb

HTML: An ordered breadcrumb list sits inside a named navigation region, with aria-current on the current location.

HTML✓ Tested
JavaEncoding & structured values

Inspect components of a URI

Java: Use URI parsing instead of splitting a URL at punctuation manually.

Java✓ Tested
CStructures & function interfaces

Iterate over a fixed array of records

C: Compute the array element count with sizeof at the point where it is still an array.

C✓ Tested