Suppose 7 names are stored in a array of pointers names[] as shown below:
char *names [ ]= { “Anand”,”Naureen”,”Banjot”,”Wahid”,”sheena” };
Write a program to reverse the order of these names.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
#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]<<end1;
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]<<end1;
getch();
}