#include<iostream.h>
#include<conio.h>
#include<string.h>
void main()
{
clrscr();
char
*name[]={"anand","naureen","banjot","wahid","sheena"};
int i,j;
cout<<"\nOriginal
string\n";
for(i=0;i<5;i++)
cout<<name[i]<<endl;
char *t;
for(i=0,j=4;i<5/2;i++,j--)
{
t=name[i];
name[i]=name[j];
name[j]=t;
}
cout<<"\nReversed
string:\n";
for(i=0;i<5;i++)
cout<<name[i]<<endl;
getch();
}
OUTPUT:
Original string
anand
naureen
banjot
wahid
sheena
Reversed string:
sheena
wahid
banjot
naureen
anand
No comments:
Post a Comment