Code Room
Code reviewHardcr-g168
Subject Buffer overflowLevel Senior–Staff~30 minCommon in Code quality & review interviewsIndustries Software development

Question

Review this C array allocator that multiplies count by element size.

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.

Talk through your review
Code to reviewc
#include <stdlib.h>#include <string.h> int *copy_ints(const int *src, unsigned count) {    int *dst = malloc(count * sizeof(int));    if (!dst) return NULL;    memcpy(dst, src, count * sizeof(int));    return dst;}
Run or narrate your approach, then ask the coach.