Can anyone explain this operator with a good example?
I know what this operator is. I mean a real-life example.
noun, plural C's or Cs, c's or cs. the third letter of the English alphabet, a consonant. any spoken sound represented by the letter C or c, as in cat, race, or circle. something having the shape of a C. a written or printed representation of the letter C or c.
C programming language is a machine-independent programming language that is mainly used to create many types of applications and operating systems such as Windows, and other complicated programs such as the Oracle database, Git, Python interpreter, and games and is considered a programming foundation in the process of ...
C is a function driven language because C is a procedural programming language. C++ is an object driven language because it is an object oriented programming. Function and operator overloading is not supported in C. Function and operator overloading is supported by C++.
C language is a system programming language because it can be used to do low-level programming (for example driver and kernel). It is generally used to create hardware devices, OS, drivers, kernels, etc. For example, Linux kernel is written in C. It can't be used for internet programming like Java, .Net, PHP, etc.
For example, like this:
var result = a ^ b;
result a b
--------------------------------
true true false
true false true
false true true
false false false
It is an implementation of the the logical operation exclusive disjunction
http://en.wikipedia.org/wiki/Exclusive_or
Exclusive disjunction is often used for bitwise operations. Examples:
- 1 xor 1 = 0
- 1 xor 0 = 1
- 0 xor 1 = 1
- 0 xor 0 = 0
- 1110 xor 1001 = 0111 (this is equivalent to addition without carry)
As noted above, since exclusive disjunction is identical to addition modulo 2, the bitwise exclusive disjunction of two n-bit strings is identical to the standard vector of addition in the vector space (Z/2Z)^4.
In computer science, exclusive disjunction has several uses:
- It tells whether two bits are unequal.
- It is an optional bit-flipper (the deciding input chooses whether to invert the data input).
- It tells whether there is an odd number of 1 bits ( is true iff an odd number of the variables are true).
(and a whole ton of other uses)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With