+ 2

What does ^= stands for in c programming? For example see description.

{ *p1^= *p2; *p2^= *p1; *p1 ^= *p2 }

6th Oct 2017, 9:11 AM
Akash papnai
Akash papnai - avatar
5 Respostas
+ 18
^= means bitwise exclusive OR assignment [https://msdn.microsoft.com/en-us/library/c1bc2s4b(v=vs.100).aspx]
6th Oct 2017, 9:17 AM
Babak
Babak - avatar
+ 17
int i = 2; 0010 in binary int j = 5; 0101 in binary i ^= j; means i = i ^ j; 0010 ^ 0101 --------- 0111 after that i = 7;
6th Oct 2017, 9:19 AM
Babak
Babak - avatar
+ 15
#include <iostream> using namespace std; int main() { int i = 2; int j = 5; cout << i << endl; i ^= j; cout << i; } [https://code.sololearn.com/cHvXMdjMng8d]
6th Oct 2017, 9:24 AM
Babak
Babak - avatar
+ 2
can you please elaborate?
6th Oct 2017, 9:16 AM
Akash papnai
Akash papnai - avatar
+ 2
👍
6th Oct 2017, 9:27 AM
Akash papnai
Akash papnai - avatar