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
How is data hiding achieved in c++?
What is the difference between mutex and binary semaphore?
What is the type of this pointer in c++?
How does java differ from c and c++?
What is the size of a vector?
How to tokenize a string in c++?
Can we change the basic meaning of an operator in c++?
Can I learn c++ in a week?
What is the purpose of ios::basefield in the following statement?
declare an array of structure where the members of the structure are integer variable float variable integer array char variable access all elements of the structure using dot operator and this pointer operator
How many characters are recognized by ANSI C++?
write a corrected statement in c++ so that the statement will work properly. x = y = z + 3a;
What do you mean by ‘void’ return type?
Explain terminate() function?
Can I learn c++ without c?