First Upload
This commit is contained in:
32
22- recorstion2/ex5.c
Normal file
32
22- recorstion2/ex5.c
Normal file
@@ -0,0 +1,32 @@
|
||||
#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)
|
||||
{
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user