array of string problem

#include<iostream>
#include<string>
#include<conio.h>
using namespace std;
int main(){
string array[5][5];
int i=0,j=0;
string z[5]={"abdgh","ygurjc","guqhkcn","asdfh","sent"};
for(i=0;i<5;i++)
for(j=0;j<4;j++)
{
array[i][j]=z[i][j];
cout<<"\narr[][]="<<array[i][j];
}
for(i=0;i<5;i++)
cout<<"\narr="<<array[i]<<endl; //this z not working

getch();
return 0;

}
array[i] is a string pointer. What did you expect it to do?

Did you mean this:
z[i]?

What are you trying to do?
Last edited on
actually....
i have wrongly written
string array[5][5].....it should be : string arr[5].....now plz see this and replace all occurences of array with arr[5]....
i m using z[1][2] to access the individual character i.e. 'u' , of string z[1]("ygurjc")....
plz help me with the last cout-line of the code.....why i am unable to get any o/p despite of the fact that i have stored chars into it.??
Topic archived. No new replies allowed.