Print reverse of a string using recursion:
# include <stdio.h>
/* Function to print reverse of the passed string */
void reverse(char *str)
{
if(*str)
{
reverse(str+1);
printf("%c", *str);
}
}
int main()
{
char a[] = "Tech Stuff for Interview";
reverse(a);
return 0;
}
No comments:
Post a Comment