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


Please Help Members By Posting Answers For Below Questions

Tell me what are static member functions?

818


What are the differences between java and c++?

723


What's the order in which the local objects are destructed?

1023


Show the declaration for a static function pointer.

803


What is the use of this pointer in c++?

804


What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required

795


What is the use of function pointer?

771


Explain the use of vtable.

841


Why do we need constructors in c++?

859


Draw a flow chart and write a program for the difference between the sum of elements with odd and even numbers. Two dimensional array.

6159


Why use of template is better than a base class?

877


How does list r; differs from list r();?

914


How does c++ structure differ from c++ class?

842


Why are pointers not used in c++?

840


What is a sequence in c++?

779