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. · اضغط تشغيل لرؤية المخرجات هنا.