error: invalid operands of types 'int' and '<unresolved overloaded function type>' to binary 'operator<<'

c++

Solution

`<<` has a higher precedence than that of `&`, so you need:

std::cout << ((c >> 3) & 1) << std::endl;
std::cout << ((c >> 4) & 1) << std::endl;
std::cout << ((c >> 5) & 1) << std::endl;

Problem

i want to get the 6th bit of 48th character of z_Data ``` { char c = pPkt->z_Data[47]; // this z_Data is a char buffer std::cout<<(c>>3)&1<<std::endl; std::cout<<(c>>4)&1<<std::endl; std::cout<<(c>>5)&1<<std::endl; } ```

Original source