+ 2
What does ^= stands for in c programming? For example see description.
{ *p1^= *p2; *p2^= *p1; *p1 ^= *p2 }
5 Antworten
+ 18
^= means bitwise exclusive OR assignment
[https://msdn.microsoft.com/en-us/library/c1bc2s4b(v=vs.100).aspx]
+ 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;
+ 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]
+ 2
can you please elaborate?
+ 2
👍