Code Room
Code reviewMedium
Question
Review this C string-copy helper.
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 <string.h>#include <stdlib.h> char *dup_upper(const char *src) { size_t len = strlen(src); char *out = malloc(len); /* room for the chars */ for (size_t i = 0; i < len; i++) { char c = src[i]; out[i] = (c >= 'a' && c <= 'z') ? c - 32 : c; } out[len] = '\0'; /* terminate */ return out;}Run or narrate your approach, then ask the coach.