Question.3
A developer builds a log message:
char log[16] = "SENSOR:"; char *value = "TEMP=25.5C,HUM=60%"; strcat(log, value);
The log buffer is 16 bytes. What happens?
log
Select Answer
log contains "SENSOR:TEMP=25.5C,HUM=60%" — safely concatenated
"SENSOR:TEMP=25.5C,HUM=60%"
Buffer overflow — the combined string (25 bytes + \0) far exceeds the 16-byte buffer
\0
strcat truncates the value to fit the remaining space
strcat
Compilation error — strcat cannot append a char* to a char[]
char*
char[]