32 lines
888 B
C
32 lines
888 B
C
#include "General.h"
|
|
|
|
#define ASCII_A 'A'
|
|
|
|
//---------------------------------------------------------------------------------------
|
|
// CountAChar
|
|
// ----------
|
|
//
|
|
// General : Count the amount of characters that are A in string.
|
|
//
|
|
// Parameters :
|
|
// str - a pointer of string (char *)
|
|
//
|
|
// Return value : Count the amount of characters that are A in string (unsigned int).
|
|
//
|
|
//---------------------------------------------------------------------------------------
|
|
// Programmer : Cohen Idan
|
|
// Student No : 211675038
|
|
// Date : 30.12.2019
|
|
//---------------------------------------------------------------------------------------
|
|
unsigned int CountAChar(char * str)
|
|
{
|
|
if (!(*str))
|
|
return (ZERO);
|
|
else
|
|
return (CountAChar(++str) * ((*str) == ASCII_A));
|
|
}
|
|
|
|
void main(void)
|
|
{
|
|
|
|
} |