Anoos Sb
Anoos Sb

Reputation: 453

What is the name of this operator "^"?

I know that this operator does the "AND logical operator" but I don't know how to deal with it and if it deals with decimal numbers or just binary numbers ?

Upvotes: 0

Views: 260

Answers (4)

Collin
Collin

Reputation: 12287

That is the bitwise XOR operator.

It performs an exclusive or operation.

Upvotes: 4

Fred Foo
Fred Foo

Reputation: 363597

It is not the logical AND, it's the bitwise XOR. It operates on integers, which are always binary numbers in C++, and may be overloaded for other types.

Upvotes: 1

Luchian Grigore
Luchian Grigore

Reputation: 258618

That's the bitwise XOR operator (so not logical, not AND) and decimal numbers are represented as binaries, so of course it works for them as well.

The logical AND is && and the bitwise AND is &.

Upvotes: 0

Andrew Hare
Andrew Hare

Reputation: 351526

It is the the XOR operator:

XOR (Exclusive Or)

This operation is performed between two bits (a and b). The result is 1 if either one of the two bits is 1, but not in the case that both are. There for, if neither or both of them are equal to 1 the result is 0.

Upvotes: 10

Related Questions