user26818: I have a byte that I am looking to break into 2 nibbles. The leftmost nibble I can get easily via shifting right 4 times. However, I can't figure out how to get the rightmost nibble. Any ideas?

user4143: Just mask it with an AND operator:
val = var & 0xF;


26818: <p>I have a byte that I am looking to break into 2 nibbles. The leftmost nibble I can get easily via shifting right 4 times. However, I can't figure out how to get the rightmost nibble. Any ideas?</p>
 4143: <p>Just mask it with an AND operator:</p>

<pre><code>val = var &amp; 0xF;
</code></pre>
