Results for “struct”
Small, practical examples. Search by task or narrow things down below.
Format a known timestamp in UTC
C: gmtime converts to UTC calendar fields and strftime formats them.
C✓ Tested
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
Generate a bounded integer range
JavaScript: Array.from supplies each output position to its mapping function.
JavaScript✓ Tested
Generate a bounded integer range
TypeScript: Array.from supplies each output position to its mapping function.
TypeScript✓ Tested
Give a reusable record type a short name
C: A typedef names a structure type without changing its representation.
C✓ Tested
Give a section an accessible region name
HTML: A section becomes a named landmark when its heading is referenced with aria-labelledby.
HTML✓ Tested
Handle a malformed JSON document
PowerShell: ConvertFrom-Json reports a terminating conversion error under the selected error preference.
PowerShell✓ Tested
Handle malformed JSON input
Python: Catch JSONDecodeError without hiding unrelated programming errors.
Python✓ Tested
Identify a search region with the search element
HTML: The native search element exposes a search landmark in supporting browsers.
HTML✓ Tested
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
Inspect components of a URI
Java: Use URI parsing instead of splitting a URL at punctuation manually.
Java✓ Tested
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