Code RoomGreet crashes on long input
MediumPrep Room Coding #1797

Greet crashes on long input

Code reviewAlgorithms & data structuresMid–Senior~20 min

Review this C function that reads a username into a fixed buffer.

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.

0:00 of about 20 min
Mark a line and say what kind of problem it is.0 findings
1#include <stdio.h>
2#include <string.h>
3 
4void greet(const char *input) {
5 char name[16];
6 strcpy(name, input);
7 printf("Hello, %s\n", name);
8}
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.