Question.1
A developer builds a response string for UART transmission:
char resp[4]; resp[0] = 'O'; resp[1] = 'K'; resp[2] = '\r'; resp[3] = '\n'; printf("%s", resp);
What happens when printf is called?
printf
Select Answer
Prints OK followed by carriage return and newline — correct output
OK
Prints OK\r\n followed by garbage characters — the string has no null terminator, so printf reads past the array
OK\r\n
Compilation error — resp is too small
resp
Prints only OK — \r and \n are ignored
\r
\n