Wednesday, 23 April 2014

23. Write a program to input a string and output the reversed string, i.e. if"USF" is input, the program has to output "FSU". You are not to use array notation to access the characters, instead please use pointer notation.



#include<stdio.h>
#include<conio.h> main()
{
char *str; int len,i; clrscr();
printf("enter the string\n"); gets(str);
len=strlen(str); for(i=len-1;i>=0;i--)
printf("%c",*(str+i)); getch();
return 0;
}

No comments:

Post a Comment