Hello guys ...
can anyone help me or guide me if i am thinking wrong,
can we copy character array into character array.
like

char names[250];
cin>>names;
names=names+names;

like we do with
int a;
cin>>a;
a=a+a;

can we do this with character array

i want to store 7 names into one charracter array using loop e.g.

char names[250];
int i=1
while(i<=7)
{
 cin>>names;
 names=names + names;
 i++
}

this is not working with me .. any other way ?
and how i then print out seperate names ..?

There is no sense in storing all names in the same char array. What you're looking for is an array of strings.

string names[7];
for (int i=0;i<7;i++)
{ 
  cin >> names[i];
}

thanks for the guide i was not aware of string array ... i thought char array is also called string array ..
thanks again aranarth

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.