Discussion: swap char array.
Afficher un message
Vieux 26/12/2007, 19h33   #1
NK
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut swap char array.

char *a="nnnnnnn fgjfjgjf";
char *b="ABC jjjjjjjjjhhhh";

to swap these two string......
this swap fn is working

template<class T>
void Swap( const T *&a,const T *&b)//no need to write const
{
T *temp;
temp=a;

a=b;

b=temp;


}



but to swap


char a[]="nhfhdhfhh fgjfjgjf";
char b[]="ABC jjjjjjjjjhhhh";

these char array its not.
why?
how a[] and b[] can be swapped?
give effficient soln.
don't use swap fn of string library(string1.swap(string2))



Thanx in advance
  Réponse avec citation
 
Page generated in 0,04159 seconds with 9 queries