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

Why is main function important?

861


program explaining feautures of c++

2201


What is the use of setprecision in c++?

763


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

888


how to explain our contribution in the project?

3412


Which programming language should I learn first?

813


What is a storage class?

933


Is c++ an oop?

836


State the difference between delete and delete[].

841


What are keywords in c++?

865


What is istream and ostream in c++?

834


Which should be more useful: the protected and public virtuals?

805


What is the standard template library (stl)?

1120


How do you establish a has-a relationship?

850


Which function cannot be overloaded c++?

860