B
Baloff
Hello
//: C03rintBinary.cpp {O}
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
#include "printBinary.h"
#include <iostream>
void printBinary(const unsigned char val) {
for(int i = 7; i >= 0; i--)
if(val & (1 << i)) //<----this line here ????
std::cout << "1";
else
std::cout << "0";
} ///:~
val is of unsigned char type.
does the bitwise 'and' apply automatic type conversion of the results of
(1 << i)?
thanks
//: C03rintBinary.cpp {O}
// From Thinking in C++, 2nd Edition
// Available at http://www.BruceEckel.com
// (c) Bruce Eckel 2000
// Copyright notice in Copyright.txt
#include "printBinary.h"
#include <iostream>
void printBinary(const unsigned char val) {
for(int i = 7; i >= 0; i--)
if(val & (1 << i)) //<----this line here ????
std::cout << "1";
else
std::cout << "0";
} ///:~
val is of unsigned char type.
does the bitwise 'and' apply automatic type conversion of the results of
(1 << i)?
thanks