Question.3
A developer copies a received UART command into a fixed buffer:
char cmd_buf[8]; char *received = "CALIBRATE"; // 9 chars + \0 = 10 bytes strcpy(cmd_buf, received);
What happens?
Select Answer
The string is truncated to fit the 8-byte buffer
Buffer overflow — strcpy writes 10 bytes into an 8-byte buffer, corrupting adjacent memory
strcpy
Compilation error — type mismatch between char[] and char*
char[]
char*
Only the first 7 characters are copied, with \0 added at index 7
\0