Code Room
Code reviewHard
Question
Review this C dynamic-array append.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix — specific and kind.
Learn the concepts
#include <stdlib.h> typedef struct { int *data; size_t len, cap; } Vec; int *vec_push(Vec *v, int value) { if (v->len == v->cap) { v->cap = v->cap ? v->cap * 2 : 4; v->data = realloc(v->data, v->cap * sizeof(int)); } v->data[v->len] = value; return &v->data[v->len++];}Run or narrate your approach, then ask the coach.