The bitwise shift operators move bits in a byte left or right a given number of places. Shift bit values to perform binary multiplication or division, but also to test various bit values.
- [Instructor] The C language bitwise operators work … by shifting bits in a byte, … which is a very low-level programming concept. … It has some interesting uses. … These operators work like common math expressions, … x is an integer variable … to shift left or right by n bits. … The result is saved in integer variable a. … Zero bits are shifted into the value … from the left or right depending on the operator. … Bits shifted off, are gone into the ether. … In the C++ programming language, … these operators can take on different roles. … This is one area where C and C++ differ. … This code demonstrates how a bit shift looks … at the binary level. … I use my binString function … to output a string representing bits in a byte. … In the main function, … you see the shift take place at line 29. … The value of variable a is shifted … to the left one bit position. … And this loop repeats 16 times. … Build and Run, pretty. … Now let's modify the code so that the shift … is two bits at a time. …
- Writing your first C program
- Working the C development cycle
- Adding comments to code for clarity
- C language data types
- Declaring variables
- Making new data types
- Typecasting variables
- Using math, assignment, and logical operators
- Creating for and while loops
- Nesting loops
- Creating functions
- Returning values from functions
- Passing arguments to functions
- Creating recursive functions
Skill Level Intermediate
C: Data Structures, Pointers, and File Systemswith Dan Gookin2h 57m Intermediate
1. The Fundamentals of C
2. Variables and Values
3. Operators and Math
4. Decisions and Loops
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.