how to swap two strings without using any third variable ?

Answer Posted / rohit kapade

bool SwapString(char **s1,char **s2)
{
char *temp = NULL;
temp = *s1;
*s1 = *s2;
*s2 = temp;
//strcpy(temp,s1);
//strcpy(s1, s2);
//strcpy(s2, temp);
return true;
}

Is This Answer Correct ?    0 Yes 6 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Which bit wise operator is suitable for turning off a particular bit in a number?

854


What is new in c++?

854


What is a modifier in c++?

848


What is the meaning of c++?

765


What do you mean by translation unit in c++?

953


Describe delete operator?

828


why is iostream::eof inside a loop condition considered wrong?

819


Why do we use using namespace std in c++?

803


What is the difference between #define debug 0 and #undef debug?

888


What is a catch statement?

783


What sorting algorithm does c++ use?

870


Write a program using GUI concept for the scheduling algorithms in Operating system like SJF,FCFS etc..

3587


What is the difference between the functions rand(), random(), srand() and randomize()?

950


Explain stack & heap objects?

821


Function can be overloaded based on the parameter which is a value or a reference. Explain if the statement is true.

860