String length · Longueur de chaîne
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.
Longueur de chaîne
Une chaîne C est une rangée de caractères se terminant par un terminateur nul caché. Retournez combien de caractères précèdent celui-ci — basically écrire strlen vous-même. Parcourez un index vers l'avant jusqu'à atteindre le terminateur, en comptant au passage.
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. · Complétez int str_len(const char *s) pour retourner la longueur de la chaîne C s, sans utiliser strlen. Comptez les caractères jusqu'au terminateur nul.
Click Run to see the output here. · Cliquez sur Exécuter pour voir le résultat ici.