basics · beginner · ~15 min

String equality

Compare two strings character by character.

Challenge

Implement int str_equal(const char *a, const char *b) returning 1 if the strings are identical, else 0 — without calling strcmp.

Starter code

int str_equal(const char *a, const char *b) {
    /* TODO */
    return 0;
}

Solve this exercise in the browser editor — compile and run against the test harness, no setup required.