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

Explain the static storage classes in c++.

699


What are static member functions?

612


What is long in c++?

731


What are the advantages of inheritance in c++?

653


Explain differences between new() and delete()?

614






Explain the benefits of proper inheritance.

636


What are the four partitions in which c++ compiler divides the ram?

695


What is pointer to array in c++?

613


Why pointer is used in c++?

608


Which c++ operator cannot overload?

543


Write a program to find the Fibonacci series recursively.

601


What is == in programming?

611


which one is equivalent to multiplying by 2:Left shifting a number by 1 or Left shifting an unsigned int or char by 1?

711


what are function pointers?

575


What are the rules for naming an identifier?

553