SQ in silver chrome letters, a lab's gear stacked against the S: a rack, two oscilloscopes, pizza boxes and a six-pack. Strange Query Lab

CARDIAC › rust-cardiac › Message codes › RCE0037

RCE0037error

Vec.

error[RCE0037]: Vec isn't supported on CARDIAC, which has no heap: use a fixed-size array ({why})

A Vec in a program for CARDIAC.

A Vec grows on the heap. CARDIAC has 96 cells and no heap: every array's size is known before the program runs.

Use a fixed-size array, and a count of how much of it is used.

let mut t = [0i16; 20];
let mut n = 0;
loop {
    let v = inp();
    if v < 0 { break; }
    t[n] = v;
    n += 1;
}

In a terminal: cargo cardiac help RCE0037.