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 문자열에 특정 문자가 몇 번 나타나는지 반환합니다. null 종결자까지 반복하여 현재 문자가 target과 일치할 때마다 1을 추가합니다.
Complete int count_char(const char *s, char target) to return how many times target appears in the C-string s.
Click Run to see the output here. · 출력을 보려면 '실행'을 클릭하세요.