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

Wap to calculate total marks and percentage of 3 subjects, WAP TO ACCEPT MA...

WAP TO ACCEPT MARKS OF THREE SUBJECT FOR STUDENT & CALCULATE TOTAL MARKS AND PERCENTAGE #include stdio.h> #include conio.h>   void main() {            int M1,M

Area under the curve, Write a c++ program to find the area under the curve ...

Write a c++ program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points c

Program to access file system, The program must use the file named on the c...

The program must use the file named on the command line as its input file. Suppose the program is named pdbtool. Then if the user types pdbtool 1A36.pdb the program must read the d

What are some ways try / catch / throw can develop software , Q: What are s...

Q: What are some ways try / catch / throw can develop software quality? A: By removing one of the reasons for if statements. The commonly utilized alternative to try / catch

Assignment, can you tell me what is c#

can you tell me what is c#

Stand-alone dsp application, You are required to write a stand-alone DSP ap...

You are required to write a stand-alone DSP application in the C programming language. The overall objective of this application is to convert a signal from the time domain to t

MCQ, in a multilist organisation

in a multilist organisation

Stack and queues, Using Figure 10.2 as a model, illustrate the result of ea...

Using Figure 10.2 as a model, illustrate the result of each operation in the sequence ENQUEUE.Q; 4/, ENQUEUE.Q; 1/, ENQUEUE.Q; 3/, DEQUEUE.Q/, ENQUEUE.Q; 8/, and DEQUEUE.Q/ on an i

C code, how can i easily make a program?

how can i easily make a program?

Two dimension array- c program, 2-D Array- C program: Define a two dim...

2-D Array- C program: Define a two dimension array using c. void convert ( int a[10][10] , int[] , int , int); void main()   {   clrscr();   int a[10][10], b[10

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