Count a character · ספירת תווים
This page needs a recent browser (with SharedArrayBuffer support). Please update Chrome, Edge, Firefox or Safari to the latest version. · עמוד זה דורש דפדפן עדכני (תומך ב-SharedArrayBuffer). אנא עדכן את Chrome, Edge, Firefox או Safari לגרסה העדכנית ביותר.
English
Count a character
Return how many times a given character appears in a C-string. Loop over the characters until the null terminator, adding 1 each time the current character matches target.
עברית
ספירת תווים
החזר כמה פעמים תווים נתון מופיע במחרוזת C. חזור על התווים עד המסוף האפס, והוסף 1 בכל פעם שהתווים הנוכחי מתאים לtarget.
Complete int count_char(const char *s, char target) to return how many times target appears in the C-string s. · השלם את int count_char(const char *s, char target) כדי להחזיר כמה פעמים מופיע target במחרוזת ה-C s.
Click Run to see the output here. · לחץ על הרץ כדי לראות את התוצא כאן.