C = (A<<4) | B ;
Thank you for this information, but I need a little clarification because I do not understand exactly how this operator works.If you know the length of the strings you can combine them with shifting and boolean operations.
With strings you need to use library functions. There are no string concatenation operators in C. Literal strings can be concatenated explicitly as initializers or printf arguments.Rich (BB code):
C = (A<<4) | B ;
No No No. Shifting is NOT the same as rotating! Bits shifted right past the least significant bit just disappear. Similarly bits shifted left past the most significant bit also disappear, by falling into the bit-bucket.So from this 0b00000001 >>4
I get this: 0b00010000 ?
It is difficult to test it with the compiler with no display and I do not want to connect a virtual teminal just to check.
That truth table is similar to binary summing.No I do not mean binary plus. OR is a boolean operation that takes place on a bit by bit basis with no carries. The truth table looks like:
0 | 0 = 0
0 | 1 = 1
1 | 0 = 1
1 | 1 = 1
Just because two things are similar, does make them equivalent. We have a number of different operations because there are different behaviors we need to use.That truth table is similar to binary summing.
1+1=0 remainder 1
0+0=0 remainer 0
1+0=1 remainder 0
0+1=1 remainer 0
That is why I ask.
I need to sum two binary numbers like this:
I changed your numbers. Zero isn't interesting.A = 1111
B = 0001
C = A & B
C now equals 11110001
|Thread starter||Similar threads||Forum||Replies||Date|
|Binary to Seven Segment Display||Datasheets, Manuals & Parts Identification||5|
|M||How to write a binary file in ESP32||Microcontrollers||2|
|RECEIVING THE BINARY CODE FROM THE DEVICE||Microcontrollers||2|
|B||Concatenate separate simulation plots in the same pane. Is it possible?||Test & Measurement||16|
|B||Dumb question: How to "concatenate" two bytes||Microcontrollers||7|
by Jake Hertz
by Kate Smith