#include <stdio.h>
#include <string.h>
#include <string.h>
void rev(char [],int, int);
int main()
{ char ch[100];
printf("Enter a string:");
scanf("%s",ch);
printf("\nEntered string is %s",ch);
rev(ch,0,strlen(ch)-1);
return 0;
}
{ char ch[100];
printf("Enter a string:");
scanf("%s",ch);
printf("\nEntered string is %s",ch);
rev(ch,0,strlen(ch)-1);
return 0;
}
void rev(char ch[],int i,int end)
{
char c;
if(end<=i)
{
printf("\nReverse=%s",ch);
return ;
}
c=ch[i];
ch[i]=ch[end];
ch[end]=c;
i++;
end--;
rev(ch,i,end);
}
{
char c;
if(end<=i)
{
printf("\nReverse=%s",ch);
return ;
}
c=ch[i];
ch[i]=ch[end];
ch[end]=c;
i++;
end--;
rev(ch,i,end);
}
No comments:
Post a Comment