Header Ads Widget

Responsive Advertisement

Ticker

6/recent/ticker-posts

. Reverse a string using recursion in c ?

 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 

 

Post a Comment

0 Comments