swap(string1,string2) will swap two strings values easily while I use it in Main Function, But if I use it in another function and call it from main function it won't work!
this works:
int main()
{
string name1="A",name2="B";
swap(name1,name2);
}
but this one does not:
string name1="A",name2="B"; // Global Here
void exchange (string one,string two)
{
swap(one,two);
}
int main()
{
exchange(name1,name2);
}
where is the problem?