String length · אורך מחרוזת
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.
אורך מחרוזת
מחרוזת C היא שורת תווים שמסתיימת במסיין אפס נסתר. החזר כמה תווים מגיעים לפניו — בעצם כתיבת strlen עצמך. עבור עם מדד קדימה עד שתגיע למסיין, ובספור בזמן שאתה הולך.
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. · השלם את int str_len(const char *s) כדי להחזיר את אורך מחרוזת ה-C s, ללא שימוש ב strlen. ספור את התווים עד לסיום המחרוזת (null terminator).
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.