Question.4
A developer parses UART commands using strcmp:
char cmd[16]; uart_read_line(cmd, sizeof(cmd)); if (strcmp(cmd, "READ")) { execute_read(); } else { printf("Unknown command"); }
When the user sends "READ", what happens?
READ
Select Answer
execute_read() is called — the strings match
execute_read()
"Unknown command" is printed — strcmp returns 0 for a match, and 0 is false in C
strcmp
Compilation error — strcmp cannot compare with a string literal
Depends on whether the UART adds a newline character