Results for “int”
Small, practical examples. Search by task or narrow things down below.
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
Format an integer as padded hexadecimal
Format an integer as padded hexadecimal in a complete Rust program using the standard library.
Rust✓ Tested
Format an integer into a caller-owned buffer
C++: to_chars avoids allocation and reports whether the buffer was large enough.
C++✓ Tested
Format several integers in a fixed buffer
Arduino / C: snprintf limits writes to the buffer size and includes a terminating null byte.
Arduino / 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
Group records into map entries
JavaScript: Initialize an array for a missing Map key before appending its values.
JavaScript✓ Tested
Group records into map entries
TypeScript: Initialize an array for a missing Map key before appending its values.
TypeScript✓ Tested
Handle a failed string-to-integer conversion
C++: stoi throws invalid_argument when no conversion can be performed.
C++✓ Tested
Handle integer overflow without panicking
Handle integer overflow without panicking in a complete Rust program using the standard library.
Rust✓ Tested
Hide interface controls in print layout
CSS: A print media query can retain article content while removing interactive controls.
CSS✓ Tested
Increase an integer variable
Bash Scripts: Increase an integer variable with a small standalone Bash program.
Bash Scripts✓ Tested