Write a C Program to Reverse a String Using Pointers
Program:
#include<stdio.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char str[100];
char *strp,l;
int i;
printf("**************************");
printf("\nwww.flintgroups.com\n");
printf("**************************\n");
printf("Enter a String\n");
gets(str);
printf("The Reversed String is : ");
l=strlen(str);
strp=&str[l];
for(i=0;i<=l;i++)
{
printf("%c",*strp);
strp--;
}
getch();
}
Output :
if u want this program in PDF format https://docs.google.com/file/d/0BzxvPSQgnviFVFZDc3Zyak5BOTQ/edit?usp=sharing
0 comments:
Post a Comment