Write a program to swap 2 chars without using a third
varable?
char *s = "A";
char *p = "B";
Answer Posted / prasenjit roy
#include <stdio.h>
//No restrinction of datatype
#define SWAP(x,y) { x = x ^ y; \
y = x ^ y; \
x = x ^ y; \
}
void main()
{
char c = 'c';
char d = 'd';
SWAP(c, d);
}
Is This Answer Correct ? | 13 Yes | 2 No |
Post New Answer View All Answers
Why is c++ still used?
What is c++ runtime?
What are the advantages of c++?
What relational operators if statements in c++?
Write a Program for dynamically intialize a 2 dimentional array. Eg:5x20, accept strings and check for vowels and display the no.finally free the space allocated .
Explain the virtual inheritance in c++.
What are the implicit member functions of class?
Can a built-in function be recursive?
What is purpose of abstract class?
What can I safely assume about the initial values of variables which are not explicitly initialized?
What is data types c++?
What are the basics of local (auto) objects?
What is enum c++?
Does dev c++ support c++ 11?
Difference between struct and class in terms of access modifier.