/* StrchrCount.c - Return the number of times character c appears in string s.
 *
 * Created on 2015-05-18 by Ron Charlton.
 */

static char StrchrCount_rcsid[] = "$Id: StrchrCount.c 1.3 2017-09-01 10:01:21-04 Ron Exp $";

#include "StrchrCount.h"

#ifdef __cplusplus
extern "C" {
#endif

size_t
StrchrCount(const char *s, int c)
{
	size_t count = 0;

	while (*s) {
		count += (*s++ == c);
	}

	return count;
}

#ifdef __cplusplus
}
#endif
