#include<stdio.h>
#include<conio.h>
#include<string.h>
int rev(char *p,int x);
int main()
{
int m;
char a[10];
printf("Enter string:\n");
scanf("%[^\n]",a);
printf("You enetered:\n");
puts(a);
m=strlen(a);
printf("after reversing:\n");
rev(&a[strlen(a)],m);
getch();
return 0;
}
int rev(char *p, int q)
{
int i=0,j,z;
while(i!=(q+1))
{
printf("%c",*p);
*p--;
i++;
}
getch();
}
No comments:
Post a Comment