What does |= mean in c++

a |= b; is just syntactic sugar for a = a | b;. Same syntax is valid for almost every operator in C++.

But int i |= 5; is an error, because in the definition line you must have an initialisation, that is an expression that does not use the variable being declared.

int i=3;
i |= 5;

is valid and will give value 7 (3 | 5) to i.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)