answersLogoWhite

0

The most commonly used ones are AND, OR, XOR (exclusive OR).

As an example, if A = 6 (binary 110), and B = 4 (binary 100), the bitwise AND operation will compare each corresponding bit, and result in binary 100 (decimal 4). This can be used to check whether a specific bit, in variable A in this case, is equal to one or zero.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What are the operators used in C describe with example?

Operators used in c areBinary operatorAirthematic operatorlogical operatorRelational operatorBitwise operatorUnary operatorTernary operator


What is an operators and its statements?

For example '+' is an operator, and its operands are the values (expressions) on its two sides, example: 3*3 + 4*4


What is the example of binary operator?

There are many: addition, subtraction, multiplication and division are the most common. Each of these operators acts on two numbers to produce a third (which may not be different).


What are the advantage and disadvantage of operator overloadin?

Operator overloading allows c/c++ operators to have user defined meanings on user defined types. For example + operator is used to add to numbers but we can also use it for concatenating a string the only limitation is you cannot change the literal meaning of the operator.


Explain with help of an an example how FAT different from inode?

explain with help of an example, how FAT is different from inode.


What are Short circuit operators in c language?

&& and are short circuit operator in C. It means that expressions chained with these operators are only evaluated until the result is unambiguously determined. For example, the expression a && b is guaranteed to be false if a is false. In this case, the term b is not evaluated, and any possible side-effects of b will not occur. The logical OR () is implemented in a similar fashion: c d is guaranteed to be true of c evaluates to true, and d is not being evaluated in this case. The ternary ? operator is not a short circuit operator (this was listed as a short-circuit operator in a previous revision of this answer). An expression that uses the ternary operator, for example e = f ? g : h is nothing but an alternative form of an if-else construct. The terms f, g and h may each contain short-circuit operators and be evaluated in the manner discussed above, but the ternary operator itself has no short-circuit characteristic.


How do operators provide the necessary data for Java program?

Technically, they don't. Operators only compare values and/or assign new ones. In the case of operator overloading for class objects, the specifics of how a particular operator interacts with class data is defined within the class method.


What are the different user define data typesexplain with example?

what are the different user define data types explain with example


What is the basic syntax of C?

+ += - -= * *= / /= % %= = == != <= >= & && | ^ ~ << <<= >> >>= , [] () are the basic operator in TURBO C


What is pointer operator?

For example: [] * -> + - ++ -- = += -= & == < <= > >= !


What is meant when you say you overload an operator?

All operators are built-in but not all operators can operate upon data types they know absolutely nothing about. There are some exceptions such as the new operator and the sizeof operator -- both will work on any datatype. However, for those that cannot, operator overloads allow you to cater specifically for those types. An operator overload is implemented just as you would overload a function, but it is not a function per se because operators have different calling conventions to functions. It is also important to keep in mind that just because you can overload an operator, it does not mean that you should. Operators should only be overloaded when the overload would allow a user to interact with your data type in an intuitive manner; a manner that is consistent with the operator's intended purpose. So while it can be amusing to overload the plus (+) operator to perform a subtraction (-), it could hardly be called intuitive. The assignment operator is the most overloaded operator of them all. This is because it is extremely useful to be able to copy the members of one object and assign those values to another object of the same type. We can also overload the assignment operator to cater for objects of different types, but such assignments are rarely intuitive. Does it make sense to assign the properties of a banana object to a person object? Probably not. Even if you could find a practical reason for doing so, would it be an intuitive operation? Definitely not. Therefore there's no point in providing an operator to cater for this. To create an operator overload, the declaration will often be placed inside the class it pertains to. However there are exceptions. The output stream insertion operator is a good example of this. The following example demonstrates how we can overload an internal operator (the assignment operator) as well as an external operator (output stream insertion operator). #include<iostream> // required to make use of I/O streams class A { private: unsigned m_data; public: // constructors... A (const unsigned data = 0): m_data (data) {} A (const A& copy): m_data (copy.m_data) {} // accessor function (interface) unsigned get_data() const { return m_data; } // operator overloads... A& operator= (const A& rhs) { m_data = rhs.m_data; } A& operator= (const unsigned rhs) { m_data = rhs; } }; std::ostream& operator<< (std::ostream& os, const A& a { os << a.get_data(); return os; } int main() { A a, b; // invoke default constructors a = 42; // call assignment operator overload b = a; // call default assignment operator overload // call insertion operator overload std::cout << a << std::endl; std::cout << b << std::endl; } Output: 42 42


What is the need for operator overloading?

1. Most fundamental data types have pre-defined operators associated with them. For example, the C++ data type int, together with the operators +, -, *, and /, provides an implementation of the mathematical concepts of an integer. To make a user-defined data type as natural as a fundamental data type, the user-defined data type must be associated with the appropriate set of operators. 2. Increases user readabitily.