Write a program to swap 2 chars without using a third
varable?
char *s = "A";
char *p = "B";
Answer Posted / rajesh rvp
#include <stdio.h>
int main ()
{
int i;
char c,d,temp;
scanf("%c %c",&c,&d);
If (toascii (c)>toascii (d))
{
temp=c;
c=d;
d=temp;
}
return 0;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is a virtual destructor? Explain the use of it?
Will the following program execute?
What can I use instead of namespace std?
What is prototype for that c string function?
Does there exist any way to make the command line arguments available to other functions without passing them as arguments to the function?
Should I learn c++ c?
Explain "const" reference arguments in function?
Is c better than c++?
Why isn't sizeof for a struct equal to the sum of sizeof of each member?
How is c++ different from java?
Why is c++ still used?
What are the methods of exporting a function from a dll?
Which operator cannot overload?
If a round rectangle has straight edges and rounded corners, your roundrect class inherits both from rectangle and from circle, and they in turn both inherit from shape, how many shapes are created when you create a roundrect?
What is the difference between *p++ and (*p)++ ?