Intermediate Rust
Q80 / 100

What is Rust's const generics?

Correct! Well done.

Incorrect.

The correct answer is B) Generic parameters that can be compile-time constant values (not just types), like array length: struct FixedArray<T, const N: usize>

B

Correct Answer

Generic parameters that can be compile-time constant values (not just types), like array length: struct FixedArray<T, const N: usize>

Explanation

fn zeros<const N: usize>() -> [i32; N] { [0; N] } creates zero arrays of any size. [T; N] arrays are const-generic over N in std.

Progress
80/100