i need to write a recursion function thats gets a string and then print only letters (captial & small) from the end to start
for exemple:
str={"abc123#@!456DEF&^65gHj"}
Reducing(str);
output: jHgFEDcba .
but im stuck on the part of how to get the function go on to the next char all i can do is print the last char and thats it im stuck... please help
here's my code:
void Reducing(char str[])
{
if (str[0] == '\0')
return ;
if ((str[strlen(str)-1] <= 122 && str[strlen(str)-1] >= 97) || (str[strlen(str)-1] <= 90 && str[strlen(str)-1] >= 65))
putchar(str[strlen(str)-1]);
Reducing(str+(strlen(str)));
}
strlenon each iteration. Just move one character up on each iteration, then unwind.isalpha()would be cleaner and remove the magic numbers.