Skip to content

Glossary: C Basics

strlen and strcmp

Also written: strlen, strcmp, string.h

From string.h. strlen counts a string's characters before the '\0', and strcmp returns 0 when two strings are equal, so you write `strcmp(a, b) == 0`.

Where the book teaches it

Related terms

StringNull terminatorsize_t