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

Design a car management system application, 1) Database: The database nee...

1) Database: The database needs to be used for persistent storage of cars. For details of what information should be stored in the database, please see the description above. You

Do friends break encapsulation?, A: No. If they're utilized properly, they ...

A: No. If they're utilized properly, they increase encapsulation. You frequently require splitting a class in half while the two halves will have distinct numbers of instances o

How to write a global inline function, How to write a global inline functio...

How to write a global inline function First, let's get away from member functions for a moment and consider a global function.  To make a request that this function be in line:

List any six commonly found programming errors, List any six commonly found...

List any six commonly found programming errors in a C program Six commonly found errors in a C program are: 1.  Missing or misplaced  ; or  }, missing return type for a proc

Should my class declare a friend function or member function, A: Use a memb...

A: Use a member while you can and a friend when you need to. Sometimes friends are better syntactically (e.g., in class Fred, friend functions let the Fred parameter to be secon

Define some important point for bit fields with structures, Define some Imp...

Define some Important Point for bit fields with structures? Only n lower bits will be assigned to an n bit number thus type cannot take values larger than 15 (4 bits long)

Decoding , http://www.expertsmind.com/questions/decodethecode-30110560.aspx...

http://www.expertsmind.com/questions/decodethecode-30110560.aspx

String routines in c, Available in the string.h header file are the followi...

Available in the string.h header file are the following routines         strcat(string1,string2);   This joins string2 to string1; care must be taken to allocate enough space for

Algorithm, Sine function computation

Sine function computation

Arrays and pointers, i have an array of structs, and am trying to make a po...

i have an array of structs, and am trying to make a pointer that can point to a certain struct within the array

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