Reverse a string using recursion in c ?
# include <stdio.h>
#include<conio.h>
void reverse(char *string)
{
if (*string)
{
reverse(string+1);
printf("%c", *string);
}
}
int main()
{
char array[] = "Asmit for Rahul";
reverse(array);
return 0;
}
Output:
timsA rof luhaR
No comments:
Post a Comment