To swap two variables, use the bitwise XOR operator. When two integers x and y are XORed, the result is a number with all bits set to 1 wherever the bits of x and y differ. For instance, the XOR of 10 (in Binary 1010) and 5 (in Binary 0101) is 1111, while the XOR of 7 (0111) and 5 (0101) is 1111. (0010).
This is a question that most of us have asked at some point in our lives. However, it is not easy to answer because there are so many possibilities. C language uses the two-operand instruction for swapping the two numbers in the expression on the left and right side of the equals sign. This is called a swap instruction. When C language executes an assignment statement, it first stores an old value in memory and then assigns a new value to the old memory location. This process is called de-referencing.
If you have a=1 and b=2, you are swapping. If you do a=2 and b=1 in any way, this number will be swapped. You can swap numbers with or without the use of variables!
Swapping two numbers in C can have consequences on the functionality of the program. For example, if you swap two numbers, it can cause an overflow error or undefined behavior.
Learner's Ratings
4.4
Overall Rating
69%
18%
5%
5%
3%
Reviews
K
kamlesh kumawat914
5
supper
J
Jitender sharma
5
mast
B
BHUPAL SINGH
5
Bahut achha paryas behtreen skill for teach c programming love u athrva bro
T
Tech AmitCS
5
most imfrodt...............
S
shubham jangid
5
Nice for BCA students to learn programming.
A
Anjali malviya
5
C language program
M
Malhar Dapse
5
good good
P
Patel tishika
5
this application is very helpfully for learning to programing languages.
A
Aniket Navin Maske
5
chan ahe
O
Omshankar Kumar
4
hi sir;
i am when going to downloading of C compiler then this website have version of 18 . when download 18 version and all process complete then CMD will appering like this is instilling .
Share a personalized message with your friends.