Results for “Array operations”
Small, practical examples. Search by task or narrow things down below.
Allocate and free a typed array
C: Use sizeof on the pointed-to type and check allocation success before writing.
C✓ Tested
Append to an array signal immutably
Append to an array signal immutably with a standalone Angular component and explicit browser behavior.
Angular✓ Tested
Append to an array without mutating state
Append to an array without mutating state with a small React component and explicit browser behavior.
React✓ Tested
Build a JSON array from rows
Aggregate ordered text values into JSON.
json_group_array✓ Tested
Calculate a fixed array’s element count
Arduino / C: Calculate a fixed array’s element count on an Uno with the Serial Monitor set to 9600 baud.
Arduino / C✓ Tested
Chain operations that may return None
Chain operations that may return None in a complete Rust program using the standard library.
Rust✓ Tested
Check an array allocation size before multiplying
C: Compare the requested element count against SIZE_MAX divided by element size.
C✓ Tested
Check array membership with includes
JavaScript: includes uses SameValueZero comparison, which also matches NaN.
JavaScript✓ Tested
Check array membership with includes
TypeScript: includes uses SameValueZero comparison, which also matches NaN.
TypeScript✓ Tested
Collect ordered values into an array
Build a sorted array from query rows.
array_agg✓ Tested
Concatenate arrays without mutating either input
JavaScript: concat creates a shallow combined sequence.
JavaScript✓ Tested
Concatenate arrays without mutating either input
TypeScript: concat creates a shallow combined sequence.
TypeScript✓ Tested