C/C++ Arena

Step 4 of 6

Compare strings correctly

a == b on two strings compares their addresses, not their contents. To compare text, use strcmp:

if (strcmp(map, "mirage") == 0) { ... }   // equal

Your turn: read a command word. Print planting for plant, defusing for defuse, and unknown command for anything else.

Previous: Write your own strlen Next: Characters are numbers