Explain bit-wise operators, C/C++ Programming

Assignment Help:

Bit-wise Operators

Some applications require operations to be done on dissimilar bits of a byte separately. Bit-wise operators offer a facility to do just that. There are various bit-wise operators:

Unary Operator: One's Complement Operator(')

This operator is a unary operator that causes the bits of its operand to be inverted, i.e. 1 become 0 and 0 becomes 1. For instance, to see the largest possible number, which can be kept in an unsigned integer, a zero can be assigned to it. All the bits in this word will be zeros. When the one's complement operator is used on this word, all the bits will be inverted to ones, giving the largest possible number. The program to show this conversion is below:

                main()

                 {

                  unsigned u = 0;

                                printf("Value before conversion : %d\n",u);

                                u = ~u;

                                printf("Value After conversion : %d\n",u);

                }

 


Related Discussions:- Explain bit-wise operators

Help finish programming assignment, how much is it to fix a small data stru...

how much is it to fix a small data struct in a sorted list that pass itemtypes. all the code is written just logical errors

Explain looping statements, Looping Statements The statements usually u...

Looping Statements The statements usually used for looping are for, do-while, while. The goto statement can be used for looping, but its use is generally avoided as it leads to

Write a simple telephone book program, Write a simple telephone book progra...

Write a simple telephone book program that stores the names and phone numbers of your friends/acquaintances in a file. Your program should have the abilities to: a. Add entries (na

Described c++ storage classes?, A: auto: the default. Variables are created...

A: auto: the default. Variables are created and initialized automatically while they are defined and destroyed at the ending of the block containing their definition. They are not

Plot an objects, write a C code that plots an object on the window and on t...

write a C code that plots an object on the window and on the user''s click of mouse on the window, the object starts rotating continuously until the user presses the mouse again

New customer, #questionhow can i add new customer and alot him a new unique...

#questionhow can i add new customer and alot him a new unique id ..

Explain the different types of errors in php, Explain the different types o...

Explain the different types of errors in PHP. Warnings, Notices and Fatal errors are the types of errors in PHP Notices: Notices signifies non-critical errors, i.e. ac

Objects as function arguments, Objects as Function Arguments: In C prog...

Objects as Function Arguments: In C program there are several methods to define arguments, and in some case even a structure can be approved as an argument.  Similarly in C+

Flowcharts, push and pop operation using array draw flowcharts

push and pop operation using array draw flowcharts

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd