String length
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version.
String length
A C-string is a row of characters that ends with a hidden null terminator. Return how many characters come before it — basically writing strlen yourself. Walk an index forward until you reach the terminator, counting as you go.
Complete int str_len(const char *s) to return the length of the C-string s, without using strlen. Count characters until the null terminator.
Click Run to see the output here.