You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// C++ Program to demonstrate use
// of left shift operator
#include
using namespace std;
// Driver code
int main()
{
unsigned char a = 156, // a = 156(10011100), // The result is (00111000) ??? = 8 00001000 ???
cout << "a<<1 = " << (unsigned char)(a << 1) << endl;
}
Why 8 is the result of (unsigned char)(a << 1) with ( a initially = to 156) !!!
... Same result with an union Ulong / UChar[4] !!! , shift on the Ulong ...... ?????
OOPs , eureka, 56 With union, AND << cout (INT)value ( numeric) 8 in "char". !!!! Thanks your applause !
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
// C++ Program to demonstrate use
// of left shift operator
#include
using namespace std;
// Driver code
int main()
{
}
Why 8 is the result of (unsigned char)(a << 1) with ( a initially = to 156) !!!
... Same result with an union Ulong / UChar[4] !!! , shift on the Ulong ...... ?????
OOPs , eureka, 56 With union, AND << cout (INT)value ( numeric) 8 in "char". !!!! Thanks your applause !
Beta Was this translation helpful? Give feedback.
All reactions