and operator in c++ code example
Example 1: operator c++
Common operators
assignment | increment | arithmetic | logical | comparison | member | other
| decrement | | | | access |
-----------------------------------------------------------------------------
a = b | ++a | +a | !a | a == b | a[b] | a(...)
a += b | --a | -a | a && b | a != b | *a | a, b
a -= b | a++ | a + b | a || b | a < b | &a | ? :
a *= b | a-- | a - b | | a > b | a->b |
a /= b | | a * b | | a <= b | a.b |
a %= b | | a / b | | a >= b | a->*b |
a &= b | | a % b | | a <=> b | a.*b |
a |= b | | ~a | | | |
a ^= b | | a & b | | | |
a <<= b | | a | b | | | |
a >>= b | | a ^ b | | | |
| | a << b | | | |
| | a >> b | | | |
Example 2: how does ++operator works in c++
#include <stdio.h>
int main() {
int var1 = 5, var2 = 5;
printf("%d\n", var1++);
printf("%d\n", ++var2);
return 0;
}
Example 3: opperanf >> c++
packet >> rec1.getPosition().x >> rec1.getPosition().y;