COMP 206 Lecture Notes - Lecture 17: Type System, Steganography, Bitwise Operation
Document Summary
Mostly being able to use the information learned in class (bash shell script, Do not hard code the date into your program. How to get the first character of a string input to stdin: Use the idioms from last lecture to get a full word! Working with memory different operating systems need to understand the same data. Bitwise operations in c (cid:272)har (cid:272) = (cid:858)a(cid:859); A char value is one byte, which is 8 bits (either 0 or 1) Shift bits of bit_arg, shift_arg places to the left equivalent to 2^shift_arg. E(cid:454). (cid:272)har (cid:272) = (cid:858)a(cid:859); //let(cid:859)s sa(cid:455) this is (cid:1004)(cid:1005)(cid:1004)(cid:1005)(cid:1004)(cid:1005)(cid:1004)(cid:1005) c<<3; //this then becomes 10101000 bit_arg>>shift_arg. Shift bits of but_arg, shift_arg places to the right equivalent to divison by. Bitwise operators are applied one by one on each bit. 1100 & 1010 = 1000 (where 1 is true and 0 is false) E(cid:454). (cid:272)har (cid:272) = (cid:858)a(cid:859) //(cid:1004)(cid:1005)(cid:1004)(cid:1005)(cid:1004)(cid:1005)(cid:1004)(cid:1005) (cid:272)har d = (cid:858)(cid:271)(cid:859) //(cid:1004)(cid:1005)(cid:1004)(cid:1005)(cid:1004)(cid:1005)(cid:1005)(cid:1005) c & d = 01010101.