Parse Simple Command String

Easy C Protocols
Solve this problem

Write a C function to parse a simple command string of the form CMD=VALUE. The function returns the integer VALUE and validates that CMD matches expected keyword.

Constraints

  • Expected CMD="SPEED".
  • Input form "SPEED=100".
  • Return -1 on invalid format.
  • Use strtok or manual parsing.
Starter codeC
1int parse(const char* s);