First Upload
This commit is contained in:
39
22- recorstion2/ex2.c
Normal file
39
22- recorstion2/ex2.c
Normal file
@@ -0,0 +1,39 @@
|
||||
#include "General.h"
|
||||
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Akeltoni
|
||||
// --------
|
||||
//
|
||||
// General : Gets a string and arranges it "Akeltoni".
|
||||
//
|
||||
// Parameters :
|
||||
// str_start - a pointer of string (char *)
|
||||
//
|
||||
// Return value : None.
|
||||
//
|
||||
//---------------------------------------------------------------------------------------
|
||||
// Programmer : Cohen Idan
|
||||
// Student No : 211675038
|
||||
// Date : 30.12.2019
|
||||
//---------------------------------------------------------------------------------------
|
||||
void Akeltoni(char * str_start)
|
||||
{
|
||||
unsigned int str_len;
|
||||
string new_string;
|
||||
if (*str_start)
|
||||
{
|
||||
CopyString(new_string, ++str_start);
|
||||
str_len = StringLength(new_string);
|
||||
*str_start = *(new_string + str_len - ONE);
|
||||
*(new_string + str_len - ONE) = BACKSLASH_ZERO;
|
||||
CopyString(++str_start, new_string);
|
||||
Akeltoni(str_start);
|
||||
}
|
||||
}
|
||||
|
||||
void main(void)
|
||||
{
|
||||
string test = "ABCDEFGH";
|
||||
Akeltoni(test);
|
||||
printf("%s\n", test);
|
||||
}
|
||||
Reference in New Issue
Block a user