<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>coding tips Archives - NeuralLantern.com</title>
	<atom:link href="https://www.NeuralLantern.com/tag/coding-tips/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.NeuralLantern.com/tag/coding-tips/</link>
	<description></description>
	<lastBuildDate>Mon, 30 Jun 2025 06:15:26 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://www.NeuralLantern.com/wp-content/uploads/2025/04/cropped-2025-04-04-Lantern-03-32x32.png</url>
	<title>coding tips Archives - NeuralLantern.com</title>
	<link>https://www.NeuralLantern.com/tag/coding-tips/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>Master Bitwise Operators: OR, AND, NOT, XOR, NOR for Beginners</title>
		<link>https://www.NeuralLantern.com/master-bitwise-operators-or-and-not-xor-nor-for-beginners/</link>
					<comments>https://www.NeuralLantern.com/master-bitwise-operators-or-and-not-xor-nor-for-beginners/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Mon, 30 Jun 2025 06:15:25 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[AND operator]]></category>
		<category><![CDATA[binary logic]]></category>
		<category><![CDATA[binary operations]]></category>
		<category><![CDATA[bit manipulation]]></category>
		<category><![CDATA[bitwise operators]]></category>
		<category><![CDATA[C programming]]></category>
		<category><![CDATA[coding for beginners]]></category>
		<category><![CDATA[coding tips]]></category>
		<category><![CDATA[computer science basics]]></category>
		<category><![CDATA[NOR operator]]></category>
		<category><![CDATA[NOT operator]]></category>
		<category><![CDATA[OR operator]]></category>
		<category><![CDATA[programming tutorial]]></category>
		<category><![CDATA[tech tutorials]]></category>
		<category><![CDATA[XOR operator]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=173</guid>

					<description><![CDATA[<p>Learn bitwise operators (OR, AND, NOT, XOR, NOR) with clear examples. Perfect for beginners mastering binary logic in programming.</p>
<p>The post <a href="https://www.NeuralLantern.com/master-bitwise-operators-or-and-not-xor-nor-for-beginners/">Master Bitwise Operators: OR, AND, NOT, XOR, NOR for Beginners</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Master Bitwise Operators: OR, AND, NOT, XOR, NOR for Beginners" width="1380" height="776" src="https://www.youtube.com/embed/mL_wTRllqtc?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Want to understand bitwise operators? This video dives into OR, AND, NOT, XOR, and NOR with easy-to-follow examples. Learn how to use these operators for flags, masks, and more in programming. Perfect for beginners or anyone wanting to master binary logic in C or other languages. I break it down with real examples, a touch of humor, and no fluff. Subscribe for more coding tutorials, and check out my site for extra resources. Drop a comment with your questions or video ideas!</p>



<p class="wp-block-paragraph">Introduction to Logical Operators 00:00:00<br>Explanation of Bitwise OR 00:00:35<br>OR Operation Examples 00:01:01<br>Bitwise OR with Multiple Bits 00:02:12<br>Using OR for Flags 00:03:52<br>Introduction to Logical AND 00:08:06<br>AND Operation Examples 00:08:29<br>Using AND as a Mask 00:10:00<br>Checking Specific Bits with AND 00:11:17<br>Introduction to NOT Operation 00:13:36<br>Introduction to NOR Operation 00:14:38<br>Introduction to XOR Operation 00:16:37<br>XOR and Neural Networks 00:16:53<br>Conclusion and Call to Action 00:18:38</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>
</ul>



<p class="wp-block-paragraph">Please help support us!</p>



<ul class="wp-block-list">
<li>Subscribing + Sharing on Social Media</li>



<li>Leaving a comment or suggestion</li>



<li>Subscribing to our Blog</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hey everybody! In this video I&#8217;m going to talk about basic logical operators such as OR and AND.</p>



<p class="wp-block-paragraph">Uh so let&#8217;s let&#8217;s dive right into it. What am I talking about with the OR and AND?</p>



<p class="wp-block-paragraph">Suppose for the sake of argument that this notepad is totally dark and I wanted it to be really light</p>



<p class="wp-block-paragraph">and then I have to go into the system settings to fix it. Sorry let me change my theme.</p>



<p class="wp-block-paragraph">How about that?</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So suppose for the sake of argument, we&#8217;ve got, you know, a couple of bits.</p>



<p class="wp-block-paragraph">These are going to be a bitwise operations for the most part.</p>



<p class="wp-block-paragraph">In other languages, sometimes we will say logical operator, but actually we&#8217;re just</p>



<p class="wp-block-paragraph">talking about values rather than bits individually.</p>



<p class="wp-block-paragraph">So these are bitwise operators.</p>



<p class="wp-block-paragraph">Imagine we have like a couple of bits.</p>



<p class="wp-block-paragraph">Remember the possible values for bits are just, you know, a zero and a one binary.</p>



<p class="wp-block-paragraph">So suppose we have a couple of values.</p>



<p class="wp-block-paragraph">values, let&#8217;s say we have a zero here and a one.</p>



<p class="wp-block-paragraph">So if I apply a logical or to the zero and the one,</p>



<p class="wp-block-paragraph">the result is going to be a one because either the first bit or the second bit are a one.</p>



<p class="wp-block-paragraph">You could also expand these operators to have multiple sets of bits,</p>



<p class="wp-block-paragraph">but we&#8217;re just going to do, you know, one set against another set.</p>



<p class="wp-block-paragraph">In this case, each set is just one bit long, but we&#8217;ll do, we&#8217;ll do a more complicated stuff in a minute.</p>



<p class="wp-block-paragraph">If I have a zero and a one, then the answer there is, well, let me just put or maybe.</p>



<p class="wp-block-paragraph">The answer is a one.</p>



<p class="wp-block-paragraph">I&#8217;ll put or maybe at the top, just like or to let you know that we&#8217;re doing ors here</p>



<p class="wp-block-paragraph">on the top.</p>



<p class="wp-block-paragraph">So if we have a zero and a one, the answer is going to be a one.</p>



<p class="wp-block-paragraph">If we have a one and a zero, the answer is going to be a one.</p>



<p class="wp-block-paragraph">Also, if we have two ones, which looks like an L over there, I got to work on my penmanship.</p>



<p class="wp-block-paragraph">Then the answer is also going to be a one.</p>



<p class="wp-block-paragraph">if either of the bits in question are a one then the answer should be a one. The only case with an</p>



<p class="wp-block-paragraph">OR that results in a zero is if both of the bits are zero because neither the first or the second</p>



<p class="wp-block-paragraph">are actually a one right so this is the basic idea of using an OR operator and you can also do this</p>



<p class="wp-block-paragraph">with multiple bits at the same time like for example we could say let&#8217;s take a bunch of random</p>



<p class="wp-block-paragraph">work on the it&#8217;s the pressure dude the l&#8217;s are driving me crazy okay oh my god okay so i do that</p>



<p class="wp-block-paragraph">and i let go okay i&#8217;m just going to put some random bits uh underneath the the first set of</p>



<p class="wp-block-paragraph">random bits put like a zero here and then like a one here maybe and we&#8217;ll say that we&#8217;re going to</p>



<p class="wp-block-paragraph">do a logical or just like you might think of doing a you know addition or subtraction we&#8217;ll just say</p>



<p class="wp-block-paragraph">you know, addition or subtraction. We&#8217;ll just say we&#8217;re going to or these two sets of bits.</p>



<p class="wp-block-paragraph">Actually, these are six on the top and six on the bottom. If I add two more, then it&#8217;ll be a nice</p>



<p class="wp-block-paragraph">little bite for the top and the bottom. So I&#8217;m just going to do that, you know, to have eight</p>



<p class="wp-block-paragraph">bits on the top and eight bits on the bottom. Okay. So if I just want to logically or two sets</p>



<p class="wp-block-paragraph">of bits, literally, I just have to do one pair of bits at a time. So a one or zero is just a one.</p>



<p class="wp-block-paragraph">One or zero is just a one, a zero or one is a one, a one or zero is a one, a zero or one</p>



<p class="wp-block-paragraph">is a one.</p>



<p class="wp-block-paragraph">And then these ones, everything is just a one.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So that was too easy.</p>



<p class="wp-block-paragraph">Maybe if I, I don&#8217;t know, maybe if I change one of these ones to a zero, then we would</p>



<p class="wp-block-paragraph">actually be able to have a zero somewhere in here.</p>



<p class="wp-block-paragraph">So that&#8217;s a logical or a bitwise or operator or operation.</p>



<p class="wp-block-paragraph">So you can, you can kind of use this in various ways.</p>



<p class="wp-block-paragraph">can kind of use this in various ways i mean obviously if you want to manipulate some bits</p>



<p class="wp-block-paragraph">this can be pretty useful inside of the machine but there was kind of an old school way that</p>



<p class="wp-block-paragraph">people did flags with arguments they would basically say something like this they would go</p>



<p class="wp-block-paragraph">in their computer program they would say you know flag a name it something like turn on the display</p>



<p class="wp-block-paragraph">or enable caching or just like whatever right so we&#8217;ll just have a flag we&#8217;ll call it flag a</p>



<p class="wp-block-paragraph">that value is equal to a one and then maybe flag b its value is equal to a two and then flag c</p>



<p class="wp-block-paragraph">its value would be a four and then we basically just double the value of the flag and the reason</p>



<p class="wp-block-paragraph">for that c d e f i&#8217;ll just stop with f maybe oh wait that was supposed to be 16 and that&#8217;s 32.</p>



<p class="wp-block-paragraph">the reason for that is if you double the value of each flag so that uh</p>



<p class="wp-block-paragraph">and then you can do a bitwise or against all of these flags and sort of combine multiple flags.</p>



<p class="wp-block-paragraph">Because if you think about it, if we&#8217;re talking about binary,</p>



<p class="wp-block-paragraph">if we suppose this is just a regular eight bit number, then, you know, the first bit has a</p>



<p class="wp-block-paragraph">strength of one. If you&#8217;ve seen my other videos for converting between binary and hex,</p>



<p class="wp-block-paragraph">the second bit has a strength of two. The next bit has a strength of four and then eight and</p>



<p class="wp-block-paragraph">and then 32 and 64 and then 128.</p>



<p class="wp-block-paragraph">And so if you look at the flags,</p>



<p class="wp-block-paragraph">1, 2, 4, 8, 16, 32,</p>



<p class="wp-block-paragraph">they map to only one bit.</p>



<p class="wp-block-paragraph">It&#8217;s not going to be some kind of random pattern for these numbers.</p>



<p class="wp-block-paragraph">It&#8217;s literally going to be flag A is going to look like this.</p>



<p class="wp-block-paragraph">1, 2, 3, 4, 5, 6, 7, 8.</p>



<p class="wp-block-paragraph">And then flag B is going to look like this.</p>



<p class="wp-block-paragraph">1, 2, 3, 4, 5, 6, 7, 8.</p>



<p class="wp-block-paragraph">five, six, seven, eight. And flag D is going to look like this. Whoops. Let me make that green.</p>



<p class="wp-block-paragraph">Still getting used to this. Oh, sorry. C is the next one. One, two, three, four, five,</p>



<p class="wp-block-paragraph">six, seven, eight. Can you see the pattern here? Let me just do D and be done with it at this</p>



<p class="wp-block-paragraph">point. One, two, three, four, five, six, seven, eight. So because we&#8217;re increasing the value of</p>



<p class="wp-block-paragraph">the flags by a power of two, or by a power of two, they&#8217;ll always correspond to just one bit.</p>



<p class="wp-block-paragraph">they&#8217;ll always correspond to just one bit, which means if you apply a logical or operation,</p>



<p class="wp-block-paragraph">you can represent a bunch of different flags with just one number.</p>



<p class="wp-block-paragraph">Think about this.</p>



<p class="wp-block-paragraph">What if I wanted to have, oh, I don&#8217;t know.</p>



<p class="wp-block-paragraph">Let me erase this.</p>



<p class="wp-block-paragraph">What if I wanted to have some, let&#8217;s say I wanted flag A and flag D and flag F just for</p>



<p class="wp-block-paragraph">the sake of argument.</p>



<p class="wp-block-paragraph">Dang, this pen.</p>



<p class="wp-block-paragraph">It&#8217;s actually my fault completely, but I need to practice.</p>



<p class="wp-block-paragraph">but I need to practice F okay and DNF so that would basically be you know 1 2 3 4 5 6 7 8</p>



<p class="wp-block-paragraph">and then D would be the 8 so a 1 0 0 0 there and then a bunch of zeros elsewhere and then the F</p>



<p class="wp-block-paragraph">So if we did an OR between all of those, then the OR is just basically 00101001.</p>



<p class="wp-block-paragraph">And if you convert that from binary to decimal, what is that?</p>



<p class="wp-block-paragraph">That&#8217;s a 1248 plus 8 plus 1248 and then a 32.</p>



<p class="wp-block-paragraph">So 41.</p>



<p class="wp-block-paragraph">just write down the number 41 and if the programmer is smart enough to you know parse all the bits</p>



<p class="wp-block-paragraph">and everything then they&#8217;ll know that you have flags a and d and f set that&#8217;s not necessarily</p>



<p class="wp-block-paragraph">something that all the modern programs do anymore it was much more popular in the olden days but i</p>



<p class="wp-block-paragraph">think some people still kind of do it especially if they&#8217;re programming in c and other languages</p>



<p class="wp-block-paragraph">where they want speed it&#8217;s pretty fast to look at bits inside of the machine so keep that in mind</p>



<p class="wp-block-paragraph">Keep that in mind now we know how to do an OR operation and we know one reason that it might be useful and</p>



<p class="wp-block-paragraph">Yeah, okay. I&#8217;m gonna move on to the next operation</p>



<p class="wp-block-paragraph">So clearing the screen now</p>



<p class="wp-block-paragraph">Hello little doggy he barked and now he&#8217;s in the room</p>



<p class="wp-block-paragraph">Let&#8217;s do</p>



<p class="wp-block-paragraph">The logical AND operation okay, so suppose we have two bits here</p>



<p class="wp-block-paragraph">in a one only if both of the input bits are a one i&#8217;m gonna whoops i accidentally cleared the whole</p>



<p class="wp-block-paragraph">entire thing let me forget where my red pen is okay and okay so if we have a zero and a zero</p>



<p class="wp-block-paragraph">the result is zero because neither of those are a one if we have a zero and a one the result is</p>



<p class="wp-block-paragraph">still going to be zero because we need both bits to be a one to result in a one so then that means</p>



<p class="wp-block-paragraph">would also result in a zero. So you get a bunch of zeros until finally you have an input pattern</p>



<p class="wp-block-paragraph">that is just two ones. And then finally the result is one. So that&#8217;s a logical and.</p>



<p class="wp-block-paragraph">Let me do a quick example so we can and a bunch of bits together. I&#8217;m just going to do more</p>



<p class="wp-block-paragraph">random bit patterns. So there&#8217;s another L there. I&#8217;m cringing. I&#8217;m self-cringing. One, two, three,</p>



<p class="wp-block-paragraph">okay so then i&#8217;ll do like another one there and like a zero there and a zero maybe a couple of</p>



<p class="wp-block-paragraph">ones maybe three ones and then a zero and then one i guess and we&#8217;ll just say that we&#8217;re going</p>



<p class="wp-block-paragraph">to end those together so and oh man i&#8217;m mixing uppercase and lowercase like crazy</p>



<p class="wp-block-paragraph">so uh to end them together you know that bit position right here that&#8217;s going to be a one</p>



<p class="wp-block-paragraph">and then we have a zero because they don&#8217;t match they&#8217;re not both one and then we have another zero</p>



<p class="wp-block-paragraph">a one and then we have a zero and a zero and a zero and a one so this is a logical and you can</p>



<p class="wp-block-paragraph">use logical ands for a wide variety of things but one thing you can kind of do somewhat easily is to</p>



<p class="wp-block-paragraph">use one number as a mask against another number for example notice how uh suppose this was the</p>



<p class="wp-block-paragraph">input number let&#8217;s just say we have the input number up top and maybe you wanted to make sure</p>



<p class="wp-block-paragraph">because you&#8217;re you&#8217;re checking for those bits individually or maybe you want to just prevent</p>



<p class="wp-block-paragraph">the input from having certain bits on for some other reason well you can you can apply the mask</p>



<p class="wp-block-paragraph">as the second bit and use a logical and i&#8217;ll say mask here sorry you can apply a mask as the second</p>



<p class="wp-block-paragraph">bit pattern and notice how in the answer there are only ones where both you know the input and</p>



<p class="wp-block-paragraph">means if I wanted to just control only which ones are allowed I can use the mask notice how the mask</p>



<p class="wp-block-paragraph">has ones in these positions and there are definitely no zeros sorry there are definitely</p>



<p class="wp-block-paragraph">no ones in any position where a mask had a zero so the mask can kind of like you know mute or mask</p>



<p class="wp-block-paragraph">or control the input pattern if that makes sense hopefully another thing we could do if we wanted</p>



<p class="wp-block-paragraph">if one bit exists. Let me go ahead and clear this real fast. I&#8217;m going to just do maybe four</p>



<p class="wp-block-paragraph">bits this time. So we could obviously do an and against four zeros, and this would result in just,</p>



<p class="wp-block-paragraph">you know, a resulting pattern of zero. So this is not super useful. The result would just</p>



<p class="wp-block-paragraph">definitely be four zeros. But notice again how the second pattern is sort of controlling what&#8217;s</p>



<p class="wp-block-paragraph">allowed to go through from the first pattern. Suppose I wanted to check to see if that particular</p>



<p class="wp-block-paragraph">particular bit was on or off.</p>



<p class="wp-block-paragraph">All I have to do is mask it with a one in the correct pattern.</p>



<p class="wp-block-paragraph">So, you know, the second bit that I just wrote down on the bottom row,</p>



<p class="wp-block-paragraph">I just want to see if that second bit is on or off in the input pattern.</p>



<p class="wp-block-paragraph">I don&#8217;t care about any of the other bits.</p>



<p class="wp-block-paragraph">That means the result will be this.</p>



<p class="wp-block-paragraph">So now it&#8217;s much more easy for me to see if that bit is on.</p>



<p class="wp-block-paragraph">I could just compare the value of those bits to a regular integer.</p>



<p class="wp-block-paragraph">Like, for example, if we consider that this was the one and this was the two</p>



<p class="wp-block-paragraph">considered that this was the one and this was the two and this was the four or sorry four and then</p>



<p class="wp-block-paragraph">the eight I could just ask now if the final value equals two and then I would know if that bit was</p>



<p class="wp-block-paragraph">on or not in the original pattern and so if I wanted to check to see if this other you know</p>



<p class="wp-block-paragraph">bit was on I can move this over here and set that back to a zero so the resulting pattern would be</p>



<p class="wp-block-paragraph">zeros then I&#8217;d ask myself is the resulting value equal to four no it&#8217;s equal to zero and so then</p>



<p class="wp-block-paragraph">Another thing you can do that I&#8217;m going to talk about in a future video is just sort of shift the bits over.</p>



<p class="wp-block-paragraph">You could, instead of checking to see if the value was a 4 or like a direct integer,</p>



<p class="wp-block-paragraph">you could just sort of shift over a certain number of spots and then check to see if it was equal to 1 or 0.</p>



<p class="wp-block-paragraph">Let me put this 1 back over into its original position just so that we&#8217;ll have something that had a 1.</p>



<p class="wp-block-paragraph">is one from uh you know the right side if it&#8217;s one to the left from the right side</p>



<p class="wp-block-paragraph">then i could just shift all the bits one to the right and end up with a pattern that is zero zero</p>



<p class="wp-block-paragraph">zero one i&#8217;m not going to talk about bit shifting operations in this video but just know that you can</p>



<p class="wp-block-paragraph">and you&#8217;ll see more of it in a future video so then you know this is another way to check to</p>



<p class="wp-block-paragraph">see if a bit was on first you do a mask for that bit and then you shift bits and then you just</p>



<p class="wp-block-paragraph">check to see if the final value is a zero or one which may or may not feel easier than checking for</p>



<p class="wp-block-paragraph">or may not feel easier than checking for an actual integer in your program.</p>



<p class="wp-block-paragraph">Okay, so we&#8217;ve done OR and also AND. The next bit pattern is called a NOT, which is really easy.</p>



<p class="wp-block-paragraph">It&#8217;s literally just an inversion of the original bit pattern. So for the NOT, we don&#8217;t really take</p>



<p class="wp-block-paragraph">two bits against each other. We just take an input bit and we just invert it. We&#8217;ll just say</p>



<p class="wp-block-paragraph">So that&#8217;s a knot. Pretty easy. We could also knot, you know, a random bit pattern with Ls.</p>



<p class="wp-block-paragraph">So I swear, somebody&#8217;s going to show up and this is their first computer science video.</p>



<p class="wp-block-paragraph">They&#8217;re going to go tell their parents, hey, there&#8217;s Ls in computer science.</p>



<p class="wp-block-paragraph">So sorry. I&#8217;m so sorry. Okay. So I got four there. So if I knot those, then that&#8217;s pretty easy.</p>



<p class="wp-block-paragraph">It&#8217;s just going to be the opposite, you know, an inversion.</p>



<p class="wp-block-paragraph">you know, an inversion.</p>



<p class="wp-block-paragraph">One, zero, one, zero.</p>



<p class="wp-block-paragraph">Let me just double check that I did that correctly.</p>



<p class="wp-block-paragraph">Yeah, so that&#8217;s the knot pattern.</p>



<p class="wp-block-paragraph">No big deal.</p>



<p class="wp-block-paragraph">Pretty easy.</p>



<p class="wp-block-paragraph">So then maybe the next thing that we can talk about is the nor,</p>



<p class="wp-block-paragraph">which just means not or.</p>



<p class="wp-block-paragraph">So let me draw that out real fast just to show you what I&#8217;m talking about.</p>



<p class="wp-block-paragraph">So if we do nor, pretty much you can imagine first taking the or and then knotting it.</p>



<p class="wp-block-paragraph">So inverting the or.</p>



<p class="wp-block-paragraph">the OR. So for example, if we have two bits here, actually, let me, let me do, let me do a</p>



<p class="wp-block-paragraph">sequential counter. Cause I think that&#8217;s more fun. I&#8217;m counting right now from one to a three</p>



<p class="wp-block-paragraph">or a actually, I do that in the last one. I started with zero. I hope let&#8217;s count from zero</p>



<p class="wp-block-paragraph">to three. So zero and then one and then two and then three. So I&#8217;m counting in binary.</p>



<p class="wp-block-paragraph">two input bits and we&#8217;re going to do a nor then the first thing we probably want to do is take</p>



<p class="wp-block-paragraph">the or operator so that would be a zero here i&#8217;ll just put or in parentheses just to let you know</p>



<p class="wp-block-paragraph">that this is kind of a nice first step you could memorize nor if you wanted to but i don&#8217;t i don&#8217;t</p>



<p class="wp-block-paragraph">really remember how to do it without doing these steps so uh it&#8217;s going to be ones for everything</p>



<p class="wp-block-paragraph">else because in the or you get a one if either of those is a one and then uh the next step is you</p>



<p class="wp-block-paragraph">the or i&#8217;ll just put nor here just to let you well just to let you know that you&#8217;re uh well i</p>



<p class="wp-block-paragraph">don&#8217;t know if i put nor then it kind of sounds like i&#8217;m norring that one bit doesn&#8217;t it so maybe</p>



<p class="wp-block-paragraph">here i&#8217;ll say uh not just to let you know that this is just one step against the previous bit</p>



<p class="wp-block-paragraph">so the knot is uh just going to be an inversion and so the nor of zero zero is one the nor of zero</p>



<p class="wp-block-paragraph">nor of 1 1 is 0 and that&#8217;s how you do a nor and all of these logical or bitwise</p>



<p class="wp-block-paragraph">operators can be used in circuits and circuit design and just you know other</p>



<p class="wp-block-paragraph">types of logical operations I&#8217;m gonna move on let&#8217;s see the next one is gonna</p>



<p class="wp-block-paragraph">be XOR that I wanted to talk about in this video so what is XOR it just means</p>



<p class="wp-block-paragraph">exclusive or so it&#8217;s a little bit more complicated than or this is actually a</p>



<p class="wp-block-paragraph">one because it has a history with neural networks. When you have a neural network that does not have</p>



<p class="wp-block-paragraph">more than one, or sorry, if you have a neural network that does not have any hidden layers,</p>



<p class="wp-block-paragraph">like if you just have an input layer and an output layer, then the neural network should</p>



<p class="wp-block-paragraph">actually not be able to solve XOR. It should not be able to learn it. You have to increase the</p>



<p class="wp-block-paragraph">topology of the neural network in some way, make it a little bit more complicated. For example,</p>



<p class="wp-block-paragraph">one or more middle layers between the input and the output layers. If you understand neural</p>



<p class="wp-block-paragraph">networks, it&#8217;s just kind of fun to know, oh, XOR stumps a shallow network and kind of starts to</p>



<p class="wp-block-paragraph">prove that deep networks might be a little bit smarter or deepish at least. Okay. So XOR,</p>



<p class="wp-block-paragraph">let&#8217;s start off by counting here. I&#8217;m going to do zero and zero, and then this is the number one,</p>



<p class="wp-block-paragraph">and this is the number two, and this is the number three. And exclusive OR just basically means</p>



<p class="wp-block-paragraph">just basically means an or but if both of the bits are one then it&#8217;s a zero so that means</p>



<p class="wp-block-paragraph">either of the bits can be a one to produce a one but it must be exclusive the bit that is a one</p>



<p class="wp-block-paragraph">can&#8217;t also be next to another bit that&#8217;s a one so let me show you so in is in a double zero</p>



<p class="wp-block-paragraph">the answer is just going to be a zero in a zero and one the answer is going to be a one in a one</p>



<p class="wp-block-paragraph">exclusive, the one is it has a, it has a buddy or a partner.</p>



<p class="wp-block-paragraph">It&#8217;s not an exclusive one.</p>



<p class="wp-block-paragraph">So we&#8217;ll say that that&#8217;s a zero.</p>



<p class="wp-block-paragraph">So that&#8217;s the XOR.</p>



<p class="wp-block-paragraph">I don&#8217;t know.</p>



<p class="wp-block-paragraph">You could put like a, a, a not on top of that or an and on top of that or whatever</p>



<p class="wp-block-paragraph">you wanted to do.</p>



<p class="wp-block-paragraph">And we can make stuff that&#8217;s a lot more complicated, but these are the basics of</p>



<p class="wp-block-paragraph">or and not XOR and NOR as bitwise operators.</p>



<p class="wp-block-paragraph">So thank you for watching this video.</p>



<p class="wp-block-paragraph">That&#8217;s all I have to say for now.</p>



<p class="wp-block-paragraph">See you in the next one.</p>



<p class="wp-block-paragraph">Hope you learned a little bit and had a little bit of fun.</p>



<p class="wp-block-paragraph">I&#8217;m out.</p>



<p class="wp-block-paragraph">social media website that you&#8217;re looking at right now it would really mean the world to me and it&#8217;ll</p>



<p class="wp-block-paragraph">help make more videos and grow this community so we&#8217;ll be able to do more videos longer videos</p>



<p class="wp-block-paragraph">better videos or just i&#8217;ll be able to keep making videos in general so please do do me a kindness</p>



<p class="wp-block-paragraph">and uh and subscribe you know sometimes i&#8217;m sleeping in the middle of the night and i just</p>



<p class="wp-block-paragraph">wake up because i know somebody subscribed or followed it just wakes me up and i get filled</p>



<p class="wp-block-paragraph">with joy that&#8217;s exactly what happens every single time so you could do it as a nice favor to me or</p>



<p class="wp-block-paragraph">it as a nice favor to me or you could you could troll me if you want to just wake me up in the</p>



<p class="wp-block-paragraph">middle of the night just subscribe and then i&#8217;ll i&#8217;ll just wake up i promise that&#8217;s what will</p>



<p class="wp-block-paragraph">happen also uh if you look at the middle of the screen right now you should see a qr code which</p>



<p class="wp-block-paragraph">you can scan in order to go to the website which i think is also named somewhere at the bottom of</p>



<p class="wp-block-paragraph">this video and it&#8217;ll take you to my main website where you can just kind of like see all the videos</p>



<p class="wp-block-paragraph">i published and the services and tutorials and things that i offer and all that good stuff and</p>



<p class="wp-block-paragraph">if you have a suggestion for uh uh clarifications or errata or just future videos that you want to</p>



<p class="wp-block-paragraph">see please leave a comment or if you just want to say hey what&#8217;s up what&#8217;s going on you know</p>



<p class="wp-block-paragraph">just send me a comment whatever i also wake up for those in the middle of the night i get i wake up</p>



<p class="wp-block-paragraph">in a cold sweat and i&#8217;m like it would really it really mean the world to me i would really</p>



<p class="wp-block-paragraph">appreciate it so again thank you so much for watching this video and um enjoy the cool music</p>



<p class="wp-block-paragraph">the cool music as I fade into the darkness which is coming for us all.</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/master-bitwise-operators-or-and-not-xor-nor-for-beginners/">Master Bitwise Operators: OR, AND, NOT, XOR, NOR for Beginners</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/master-bitwise-operators-or-and-not-xor-nor-for-beginners/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Master Debugging with xxd: Inspect Program Output at a Byte Level for Automation &#038; Clean Code!</title>
		<link>https://www.NeuralLantern.com/master-debugging-with-xxd-inspect-program-output-at-a-byte-level-for-automation-clean-code/</link>
					<comments>https://www.NeuralLantern.com/master-debugging-with-xxd-inspect-program-output-at-a-byte-level-for-automation-clean-code/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Mon, 23 Jun 2025 02:41:27 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[assembly programming]]></category>
		<category><![CDATA[automation debugging]]></category>
		<category><![CDATA[binary file inspection]]></category>
		<category><![CDATA[byte level debugging]]></category>
		<category><![CDATA[clean code]]></category>
		<category><![CDATA[coding tips]]></category>
		<category><![CDATA[coding tutorial]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[linux tools]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[programming errors]]></category>
		<category><![CDATA[software development]]></category>
		<category><![CDATA[terminal commands]]></category>
		<category><![CDATA[text file debugging]]></category>
		<category><![CDATA[xxd]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=165</guid>

					<description><![CDATA[<p>Debug program output with xxd! Learn to inspect text/binary files at byte level, fix hidden issues, and ensure clean code. Perfect for automation &#038; assignments.</p>
<p>The post <a href="https://www.NeuralLantern.com/master-debugging-with-xxd-inspect-program-output-at-a-byte-level-for-automation-clean-code/">Master Debugging with xxd: Inspect Program Output at a Byte Level for Automation &amp; Clean Code!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Master Debugging with xxd: Inspect Program Output at a Byte Level for Automation &amp; Clean Code!" width="1380" height="776" src="https://www.youtube.com/embed/UyE5t01Vnd0?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Hey coders, ever wonder why your program’s acting funky? Join me to master debugging with xxd! This vid walks you through inspecting text or binary file output at the byte level, catching sneaky characters like null bytes that mess up automation or school assignments. From assembly to redirects, learn practical tips to ensure clean output. Perfect for beginners and pros alike! Hit subscribe for more coding tutorials, and check my site for extra goodies. Let’s debug smarter, not harder!</p>



<p class="wp-block-paragraph">Introduction to xxd 00:00:00<br>Purpose of debugging 00:00:12<br>Why debug output 00:00:23<br>Example assembly program 00:00:56<br>Running the program 00:01:26<br>Corrupting the message 00:01:45<br>Terminal vs automation 00:02:27<br>Installing xxd 00:03:16<br>Redirecting output 00:03:29<br>Using xxd to debug 00:04:33<br>Identifying newline issue 00:05:36<br>Finding zero in string 00:06:04<br>Debugging conclusion 00:06:32<br>Weird symbols warning 00:06:47<br>Debugging standard error 00:07:23<br>Closing remarks 00:07:40<br>Call to subscribe 00:07:56<br>QR code and website 00:08:45<br>Request for comments 00:09:09<br>Fade out 00:09:31</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>
</ul>



<p class="wp-block-paragraph">Please help support us!</p>



<ul class="wp-block-list">
<li>Subscribing + Sharing on Social Media</li>



<li>Leaving a comment or suggestion</li>



<li>Subscribing to our Blog</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hey there, I&#8217;d like to talk to you about debugging your program&#8217;s output with xxd.</p>



<p class="wp-block-paragraph">What am I talking about? Well, there&#8217;s a program called xxd that can sort of inspect</p>



<p class="wp-block-paragraph">at the byte level the output of some text file or binary file. It&#8217;s really useful for</p>



<p class="wp-block-paragraph">inspecting things. Why would you want to debug the output of your program? Well, I don&#8217;t know.</p>



<p class="wp-block-paragraph">print a message from your program the program might be printing some extra characters somewhere</p>



<p class="wp-block-paragraph">or some garbage and maybe maybe you don&#8217;t notice because you&#8217;re sort of looking at your program&#8217;s</p>



<p class="wp-block-paragraph">output in the terminal but then maybe if your output is being sent to another program</p>



<p class="wp-block-paragraph">for the purposes of automation or like you&#8217;re getting a grade from a class or something like</p>



<p class="wp-block-paragraph">that then um well it can it can sort of it can sort of get you without you realizing what&#8217;s wrong</p>



<p class="wp-block-paragraph">you an example real fast of what i&#8217;m talking about i have a simple assembly program here this is not</p>



<p class="wp-block-paragraph">a video about how to write assembly code so just assume that you know if you want to know assembly</p>



<p class="wp-block-paragraph">see my other videos but um i&#8217;m just going to print a simple message i&#8217;m just going to print</p>



<p class="wp-block-paragraph">hello i feel awesome and then the length of the message i&#8217;m specifying here you don&#8217;t know you</p>



<p class="wp-block-paragraph">don&#8217;t need to know too much about this for this particular video i&#8217;m just printing a string in</p>



<p class="wp-block-paragraph">assembly that&#8217;s all i&#8217;m doing and then here you can see i&#8217;m just kind of like printing it and then</p>



<p class="wp-block-paragraph">I&#8217;m just kind of like printing it and then I&#8217;m like exiting.</p>



<p class="wp-block-paragraph">So if we go back to the terminal here, I can type make run.</p>



<p class="wp-block-paragraph">This is not a make file video.</p>



<p class="wp-block-paragraph">See my other videos.</p>



<p class="wp-block-paragraph">I want to type make run just to compile and run the program.</p>



<p class="wp-block-paragraph">And then here&#8217;s the message that it prints, right?</p>



<p class="wp-block-paragraph">Hello, I feel awesome.</p>



<p class="wp-block-paragraph">It looks good in the terminal.</p>



<p class="wp-block-paragraph">I can&#8217;t be 100% sure though, because think about this.</p>



<p class="wp-block-paragraph">What if I corrupted the message on purpose?</p>



<p class="wp-block-paragraph">This can happen in assembly all the time.</p>



<p class="wp-block-paragraph">Wrong or if you add extra characters at the end of it or even if you have you know a corrupted register somewhere</p>



<p class="wp-block-paragraph">That either reads from the wrong spot</p>



<p class="wp-block-paragraph">To get a string or maybe it it writes over the string for some reason. There&#8217;s a lot of things that can go wrong</p>



<p class="wp-block-paragraph">So for now just suppose that I&#8217;ve corrupted my message somehow by I don&#8217;t know. Let&#8217;s put a zero</p>



<p class="wp-block-paragraph">In between the string so I&#8217;m gonna say is that it&#8217;s gonna be like H E L</p>



<p class="wp-block-paragraph">0 L O and what that should do is</p>



<p class="wp-block-paragraph">lo and what that should do uh well it should look like just the word hello but if i&#8217;m automating</p>



<p class="wp-block-paragraph">this program or sending it in to get a grade at a school somewhere then this should you know not</p>



<p class="wp-block-paragraph">match what is expected if i&#8217;m automating with like another system in some way but it should look okay</p>



<p class="wp-block-paragraph">in the terminal let&#8217;s see i&#8217;m going to do clear and make run notice how the message looks the same</p>



<p class="wp-block-paragraph">I feel awesome. So if I was automating, you know, if I was sending this string to another program</p>



<p class="wp-block-paragraph">for automation, I might be convinced that I&#8217;m not doing anything wrong. And I&#8217;ll, I&#8217;ll think it&#8217;s</p>



<p class="wp-block-paragraph">the other side that is wrong or, or our computers are just buggy or something like that. But actually</p>



<p class="wp-block-paragraph">I&#8217;ve outputted a corrupted message for some reason. So how can I really be sure that my</p>



<p class="wp-block-paragraph">message is what I think I&#8217;m seeing in the terminal? That&#8217;s the XXD program. Pretty easy.</p>



<p class="wp-block-paragraph">apt install xxd let me see if I have it on this system oh it&#8217;s already installed</p>



<p class="wp-block-paragraph">okay good so I&#8217;m gonna do clear and make run again so there it is I would like to</p>



<p class="wp-block-paragraph">just redirect the standard output pipe to a file with a special command in the</p>



<p class="wp-block-paragraph">shell let me just show you real fast I am definitely printing to std out the</p>



<p class="wp-block-paragraph">standard pipe which is just a number one file descriptor if you don&#8217;t understand</p>



<p class="wp-block-paragraph">If you don&#8217;t understand that, I have other videos, but I&#8217;m going to run the program again,</p>



<p class="wp-block-paragraph">but then I&#8217;m going to redirect the output to a file and I&#8217;m going to call it stdout.txt.</p>



<p class="wp-block-paragraph">It&#8217;s probably a good idea to eliminate spaces.</p>



<p class="wp-block-paragraph">I think I&#8217;ve made mistakes in other videos where I didn&#8217;t put a space before or after</p>



<p class="wp-block-paragraph">this little redirector symbol and I ended up creating a file just called the number</p>



<p class="wp-block-paragraph">two or the number one.</p>



<p class="wp-block-paragraph">But pipe number one is standard output.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say anything that comes to pipe one, which is standard output, I&#8217;m just</p>



<p class="wp-block-paragraph">output I&#8217;m just going to redirect it to a text file. So when I hit enter notice</p>



<p class="wp-block-paragraph">how nothing prints to the screen but the standard output text file that I</p>



<p class="wp-block-paragraph">specified is now created. If I spill the contents of std out it still looks</p>



<p class="wp-block-paragraph">normal so don&#8217;t let that trick you but watch what happens if I use xxd.</p>



<p class="wp-block-paragraph">xxd std out basically xxd is going to read it as a binary file and tell me</p>



<p class="wp-block-paragraph">every single character in there while I oh I forgot to change the title of that</p>



<p class="wp-block-paragraph">that&#8217;s not this video but notice right here where it says H E L L O and then</p>



<p class="wp-block-paragraph">right before that there&#8217;s like a little dot if you look at the dot let&#8217;s see</p>



<p class="wp-block-paragraph">what is the dot it&#8217;s one two three four five six it&#8217;s the sixth thing one two</p>



<p class="wp-block-paragraph">one two three four five six seven eight nine ten twelve thirteen fourteen fifteen oh there&#8217;s</p>



<p class="wp-block-paragraph">fifteen characters but there&#8217;s not that many i think probably they&#8217;re packing them by two here</p>



<p class="wp-block-paragraph">let me see if that makes more sense now one two three four five six one two three four five six</p>



<p class="wp-block-paragraph">yeah that makes a lot more sense so the sixth uh byte not the sixth uh word uh is basically</p>



<p class="wp-block-paragraph">to this dot right here and if you recall oa is a decimal 10 which is uh the beginning of a new line</p>



<p class="wp-block-paragraph">you know like a carriage return line feed um 13 comma 10 so that&#8217;s what it is right there</p>



<p class="wp-block-paragraph">and then so now we know that there&#8217;s xxd is figuring out here or helping us understand</p>



<p class="wp-block-paragraph">that there&#8217;s a new line between slash main and then the message which if you recall that&#8217;s</p>



<p class="wp-block-paragraph">exactly what happened and then when we look into our hello string there&#8217;s a dot in the middle here</p>



<p class="wp-block-paragraph">string there&#8217;s a dot in the middle here what is that dot well we just have to figure out what</p>



<p class="wp-block-paragraph">number that corresponds to so the oa was that dot right there so we just got to go a couple more</p>



<p class="wp-block-paragraph">bytes forward one two three four bytes forward one two three four bytes forward it&#8217;s this zero right</p>



<p class="wp-block-paragraph">so xxd even though the terminal didn&#8217;t help us originally xxd has helped us realize that we&#8217;re</p>



<p class="wp-block-paragraph">that we&#8217;re actually printing a zero under the hood and we can&#8217;t see it in the terminal.</p>



<p class="wp-block-paragraph">So we have now debugged our output. You know, depending on where you print this,</p>



<p class="wp-block-paragraph">you might see nothing like in the terminal. It didn&#8217;t really show anything. But if you&#8217;re on a</p>



<p class="wp-block-paragraph">webpage somewhere or some other type of thing that&#8217;s going to print the data for you, you might</p>



<p class="wp-block-paragraph">see a weird symbol. I mean, it really depends. This is not something you&#8217;ll see everywhere, but</p>



<p class="wp-block-paragraph">you might see a weird symbol that kind of looks like a black diamond with a question mark inside</p>



<p class="wp-block-paragraph">mark inside of it or some other weird symbol.</p>



<p class="wp-block-paragraph">If you start seeing weird symbols all over the place or just in a place where you know</p>



<p class="wp-block-paragraph">there&#8217;s not supposed to be a weird symbol, that might be an indication to you that you</p>



<p class="wp-block-paragraph">have weird values sitting inside of your string.</p>



<p class="wp-block-paragraph">And then you should probably try to debug with XXD.</p>



<p class="wp-block-paragraph">So that&#8217;s it.</p>



<p class="wp-block-paragraph">That&#8217;s the basics for debugging with XXD.</p>



<p class="wp-block-paragraph">Just, you know, file output anyway, for your information.</p>



<p class="wp-block-paragraph">If you wanted to debug the standard error pipe, you could also do this.</p>



<p class="wp-block-paragraph">you know because the error pipe is just a two um and that&#8217;s basically it i&#8217;m not going to</p>



<p class="wp-block-paragraph">debug right now because that&#8217;s that&#8217;s too easy but i hope you enjoyed this video thank you for</p>



<p class="wp-block-paragraph">watching i hope you learned a little bit and had a little bit of fun i&#8217;ll see you in the next video</p>



<p class="wp-block-paragraph">hey everybody thanks for watching this video again from the bottom of my heart i really</p>



<p class="wp-block-paragraph">appreciate it i do hope you did learn something and have some fun uh if you could do me a please</p>



<p class="wp-block-paragraph">If you could do me a please, a small little favor, could you please subscribe and follow this channel or these videos or whatever it is you do on the current social media website that you&#8217;re looking at right now.</p>



<p class="wp-block-paragraph">It would really mean the world to me and it&#8217;ll help make more videos and grow this community.</p>



<p class="wp-block-paragraph">So we&#8217;ll be able to do more videos, longer videos, better videos, or just I&#8217;ll be able to keep making videos in general.</p>



<p class="wp-block-paragraph">So please do me a kindness and subscribe.</p>



<p class="wp-block-paragraph">the middle of the night and i just wake up because i know somebody subscribed or followed</p>



<p class="wp-block-paragraph">it just wakes me up and i get filled with joy that&#8217;s exactly what happens every single time</p>



<p class="wp-block-paragraph">so you could do it as a nice favor to me or you could you could troll me if you want to just wake</p>



<p class="wp-block-paragraph">me up in the middle of the night just subscribe and then i&#8217;ll i&#8217;ll just wake up i promise that&#8217;s</p>



<p class="wp-block-paragraph">what will happen also uh if you look at the middle of the screen right now you should see a qr code</p>



<p class="wp-block-paragraph">which you can scan in order to go to the website which i think is also named somewhere at the</p>



<p class="wp-block-paragraph">you to my main website where you can just kind of like see all the videos I published and the</p>



<p class="wp-block-paragraph">services and tutorials and things that I offer and all that good stuff and uh if you have a</p>



<p class="wp-block-paragraph">suggestion for uh uh clarifications or errata or just future videos that you want to see please</p>



<p class="wp-block-paragraph">leave a comment or if you just want to say hey what&#8217;s up what&#8217;s going on you know just send me</p>



<p class="wp-block-paragraph">a comment whatever I also wake up for those in the middle of the night I get I wake up in a cold</p>



<p class="wp-block-paragraph">it would really mean the world to me. I would really appreciate it. So again,</p>



<p class="wp-block-paragraph">thank you so much for watching this video and enjoy the cool music as I fade</p>



<p class="wp-block-paragraph">into the darkness, which is coming for us all.</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/master-debugging-with-xxd-inspect-program-output-at-a-byte-level-for-automation-clean-code/">Master Debugging with xxd: Inspect Program Output at a Byte Level for Automation &amp; Clean Code!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/master-debugging-with-xxd-inspect-program-output-at-a-byte-level-for-automation-clean-code/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Caveman Debugging: Simple Trick to Debug C++ Code Like a Pro!</title>
		<link>https://www.NeuralLantern.com/caveman-debugging-simple-trick-to-debug-c-code-like-a-pro/</link>
					<comments>https://www.NeuralLantern.com/caveman-debugging-simple-trick-to-debug-c-code-like-a-pro/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Wed, 11 Jun 2025 19:56:00 +0000</pubDate>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Debugging]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[assembly debugging]]></category>
		<category><![CDATA[beginner coding]]></category>
		<category><![CDATA[c++ debugging]]></category>
		<category><![CDATA[c++ tutorial]]></category>
		<category><![CDATA[caveman debugging]]></category>
		<category><![CDATA[code troubleshooting]]></category>
		<category><![CDATA[coding hacks]]></category>
		<category><![CDATA[coding tips]]></category>
		<category><![CDATA[debug c++]]></category>
		<category><![CDATA[debug code fast]]></category>
		<category><![CDATA[fix code bugs]]></category>
		<category><![CDATA[print statement debugging]]></category>
		<category><![CDATA[programming for beginners]]></category>
		<category><![CDATA[programming tutorial]]></category>
		<category><![CDATA[software development]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=151</guid>

					<description><![CDATA[<p>Master caveman debugging! Easy C++ trick to fix code fast with print statements. Clear tips for beginners &#038; pros. Watch now to squash bugs!</p>
<p>The post <a href="https://www.NeuralLantern.com/caveman-debugging-simple-trick-to-debug-c-code-like-a-pro/">Caveman Debugging: Simple Trick to Debug C++ Code Like a Pro!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-video is-provider-youtube wp-block-embed-youtube wp-embed-aspect-16-9 wp-has-aspect-ratio"><div class="wp-block-embed__wrapper">
<iframe title="Caveman Debugging: Simple Trick to Debug C++ Code Like a Pro!" width="1380" height="776" src="https://www.youtube.com/embed/hsGaRukvpF8?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
</div></figure>



<p class="wp-block-paragraph">Hey coders! Ever hit a wall with a program that just won’t work? In this video, I’m spilling the beans on caveman debugging—a super simple, no-fuss way to hunt down bugs in your C++ code (or any language, from assembly to Python)! No need to wrestle with complex debuggers; this method is all about using print statements to trace what your code is doing, step by step.</p>



<p class="wp-block-paragraph">I’ll show you a real C++ program where things go wrong (think integer overflows and mystery crashes) and walk you through how to sprinkle in cout statements to spot the problem fast. You’ll learn how to label decision points like loops and if-statements, break down complex expressions with temporary variables, and format your debug output so it’s easy to read. Plus, I share a neat trick called short circuiting to toggle your debug prints on or off without deleting them—saving you tons of time!</p>



<p class="wp-block-paragraph">Whether you’re a beginner just starting out or a pro debugging a massive codebase, caveman debugging is a lifesaver. It’s quick, it’s intuitive, and it fits my “let’s figure this out” vibe perfectly. Stick around to see how I catch a sneaky bug in a for-loop and fix it in minutes.</p>



<p class="wp-block-paragraph">Why watch?</p>



<ul class="wp-block-list">
<li>Learn a beginner-friendly debugging technique that works in any language.</li>



<li>See real code examples with clear, relatable explanations.</li>



<li>Get tips to make your debug output readable and avoid hours of frustration.</li>



<li>Discover how to short circuit print statements for reusable debugging.</li>
</ul>



<p class="wp-block-paragraph">If you’re ready to level up your coding game and squash bugs like a champ, smash that play button! Don’t forget to subscribe and hit the bell for more coding tutorials, from beginner hacks to advanced tricks. Drop a comment if you’ve ever used caveman debugging or have a bug you need help with—I read every one! Check out my next video on using a proper debugger for even more debugging goodness.</p>



<p class="wp-block-paragraph">Scan the QR code on-screen or visit my website (linked below) for more tutorials, services, and coding resources. Let’s keep the coding community growing—your support means the world! #CavemanDebugging #CodingTips #DebuggingHacks</p>



<p class="wp-block-paragraph">Hey everybody! In this video I&#8217;m gonna try to familiarize you with a concept</p>



<p class="wp-block-paragraph">called caveman debugging. It&#8217;s just as bad as it sounds but it&#8217;s really really</p>



<p class="wp-block-paragraph">really useful. So suppose for the sake of argument you&#8217;re writing a program I&#8217;m</p>



<p class="wp-block-paragraph">gonna show a C++ program here but this this concept is not just for C++</p>



<p class="wp-block-paragraph">debugging it&#8217;s also for assembly and any other kind of language that you can come</p>



<p class="wp-block-paragraph">other kind of language that you can come up with but suppose I have a program and I&#8217;m trying to</p>



<p class="wp-block-paragraph">figure out why it&#8217;s not working so if you look at this program right here that I&#8217;ve kind of written</p>



<p class="wp-block-paragraph">up already we have a main function here and we have like a little hello message that&#8217;s not my</p>



<p class="wp-block-paragraph">name I love that name though and we have a variable a and then we just sort of do some nonsense to it</p>



<p class="wp-block-paragraph">to try and compute a value for a when I say nonsense I mean literally I&#8217;m just I just made</p>



<p class="wp-block-paragraph">I&#8217;m just I just made up instructions the point of this video is not to show you some advanced program</p>



<p class="wp-block-paragraph">It&#8217;s just to show you that you know</p>



<p class="wp-block-paragraph">This is how you can possibly debug a program that has gone awry</p>



<p class="wp-block-paragraph">So you can imagine at home that this code you&#8217;re seeing right here might be your larger project your larger</p>



<p class="wp-block-paragraph">Code base whatever it is that you&#8217;re doing that is not working for some reason and you&#8217;re not sure why</p>



<p class="wp-block-paragraph">So, um, let me run the program real fast</p>



<p class="wp-block-paragraph">It basically is just like a little for loop and then it just sort of</p>



<p class="wp-block-paragraph">of you know not randomly but it just kind of increases the value of a for no reason</p>



<p class="wp-block-paragraph">a bunch of times and then it calls a function that will crash later</p>



<p class="wp-block-paragraph">so let me show you what happens when we try to run this program okay do do do</p>



<p class="wp-block-paragraph">okay i want to go clear and make run if you don&#8217;t know how to do a make file or compile</p>



<p class="wp-block-paragraph">or link or anything like that uh then go see my other videos so clear and make run</p>



<p class="wp-block-paragraph">What did I do wrong?</p>



<p class="wp-block-paragraph">TempResult was not declared in this scope.</p>



<p class="wp-block-paragraph">Okay, well, this is now a video on reading compiler errors.</p>



<p class="wp-block-paragraph">Line 59, I probably left something out.</p>



<p class="wp-block-paragraph">Oh, because I just changed it.</p>



<p class="wp-block-paragraph">I forgot to put it back in there.</p>



<p class="wp-block-paragraph">Return tempResult, we should just return input times two.</p>



<p class="wp-block-paragraph">And I&#8217;m just making this up.</p>



<p class="wp-block-paragraph">It&#8217;s not really like a valid algorithm.</p>



<p class="wp-block-paragraph">Okay, so we run our program.</p>



<p class="wp-block-paragraph">We print the final result and we realize for some reason the final result is wrong.</p>



<p class="wp-block-paragraph">result is wrong. So I don&#8217;t, I mean, I just made this up. So I don&#8217;t really know what the right</p>



<p class="wp-block-paragraph">answer is. But just imagine that you are looking at some sort of an output, some sort of a final</p>



<p class="wp-block-paragraph">state, maybe a crash. And you realize, oh, my program doesn&#8217;t work, but it&#8217;s too complicated</p>



<p class="wp-block-paragraph">to figure out. Caveman debugging to the rescue. Caveman debugging kind of is as bad as it sounds.</p>



<p class="wp-block-paragraph">It&#8217;s just really, really simple. But it&#8217;s also really useful, especially if you just want to do</p>



<p class="wp-block-paragraph">on you don&#8217;t want to dive deep into a full-on debugger or do something more advanced it literally</p>



<p class="wp-block-paragraph">is just printing a lot of things while your program is running i do it all the time i usually</p>



<p class="wp-block-paragraph">don&#8217;t even go to a debugger unless i really get in trouble with like some huge mess um okay so</p>



<p class="wp-block-paragraph">the first thing i&#8217;m going to say is in this for loop we uh you know we&#8217;re kind of like iterating</p>



<p class="wp-block-paragraph">And so probably this is a good idea to announce that we&#8217;re iterating in the for loop.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to go Cout.</p>



<p class="wp-block-paragraph">In C++, you know, we have the Cout object that we can use to stream texts to standard output,</p>



<p class="wp-block-paragraph">which usually goes to the terminal.</p>



<p class="wp-block-paragraph">So use whatever construct you&#8217;re using for your particular language.</p>



<p class="wp-block-paragraph">So we&#8217;re going to do Cout.</p>



<p class="wp-block-paragraph">And I should say also, if you&#8217;re programming in assembly,</p>



<p class="wp-block-paragraph">if you are programming in assembly,</p>



<p class="wp-block-paragraph">it&#8217;s a little bit more complicated than just writing a Cout.</p>



<p class="wp-block-paragraph">little bit more complicated than just writing a C out you probably have to have some pre-computed</p>



<p class="wp-block-paragraph">messages and then you can use a library to print a number to the screen or use printf to print stuff</p>



<p class="wp-block-paragraph">to the screen but you can do it just takes a little bit longer so anyway conceptually I&#8217;m</p>



<p class="wp-block-paragraph">just going to say this is the first iteration of my loop so I&#8217;m going to sort of announce it I&#8217;m</p>



<p class="wp-block-paragraph">going to say main and then I&#8217;m going to call it main four or how about primary four or first four</p>



<p class="wp-block-paragraph">but I want to try to label the for loop.</p>



<p class="wp-block-paragraph">And maybe instead of leaving those parentheses blank,</p>



<p class="wp-block-paragraph">I could say iteration number i right there,</p>



<p class="wp-block-paragraph">or maybe I could do iteration i.</p>



<p class="wp-block-paragraph">That would be pretty good.</p>



<p class="wp-block-paragraph">Then I just have to replace the i with the actual variable i</p>



<p class="wp-block-paragraph">so that the i keeps increasing.</p>



<p class="wp-block-paragraph">So I&#8217;m just going to like do another stream operator here</p>



<p class="wp-block-paragraph">and I&#8217;m going to say i.</p>



<p class="wp-block-paragraph">Then I&#8217;ll print a new line.</p>



<p class="wp-block-paragraph">we&#8217;ve got, you know, one iteration of our loop.</p>



<p class="wp-block-paragraph">Maybe I should also print what is the current value of A</p>



<p class="wp-block-paragraph">because the point of this, you know, weird nonsense code</p>



<p class="wp-block-paragraph">is we&#8217;re coming up with a value for A, right?</p>



<p class="wp-block-paragraph">So I should just print what A is at the top of each iteration of the for loop.</p>



<p class="wp-block-paragraph">So I&#8217;m going to say A is equal to, and then do another A at the end of it.</p>



<p class="wp-block-paragraph">And then maybe at the bottom of the for loop,</p>



<p class="wp-block-paragraph">when the for loop is actually ending one of its iterations,</p>



<p class="wp-block-paragraph">I can just say we&#8217;re at the bottom of the iteration so maybe I&#8217;ll put to end</p>



<p class="wp-block-paragraph">iteration and then print the final value of a and then at the top I&#8217;ll say begin</p>



<p class="wp-block-paragraph">iteration at this point you might start to feel like hey aren&#8217;t you using too</p>



<p class="wp-block-paragraph">many words here like why can&#8217;t I just print a bunch of numbers I mean you</p>



<p class="wp-block-paragraph">could but when you&#8217;re coding you need all the brainpower you can get to not</p>



<p class="wp-block-paragraph">just code but to debug coding is already hard enough without making it harder</p>



<p class="wp-block-paragraph">harder for yourself than you need it to be. So, you know, I see people all the time, they&#8217;re</p>



<p class="wp-block-paragraph">trying to debug their code and they just like start printing numbers. And after not very long</p>



<p class="wp-block-paragraph">at all, they&#8217;re looking at the debug output and they&#8217;re just like, what did that number mean?</p>



<p class="wp-block-paragraph">Where is the number I&#8217;m looking for? It&#8217;s just a bunch of numbers. It&#8217;s harder to debug when you</p>



<p class="wp-block-paragraph">do it that way. Do it the nice and pretty way. It just costs you a couple of extra keystrokes to do,</p>



<p class="wp-block-paragraph">you know, nice letters and new lines and things, nice words, labels. Isn&#8217;t that still a lot better</p>



<p class="wp-block-paragraph">Isn&#8217;t that still a lot better than debugging for an extra six hours?</p>



<p class="wp-block-paragraph">Because you can&#8217;t really understand what you&#8217;re seeing.</p>



<p class="wp-block-paragraph">Anyway, let me show you what this looks like so far with just those two lines added.</p>



<p class="wp-block-paragraph">Now we can kind of see, alright, alright, on iteration number 61, where I was 61, then</p>



<p class="wp-block-paragraph">this was the first value of A and then after that this was the second value of A, you know,</p>



<p class="wp-block-paragraph">when we were finished with the iteration.</p>



<p class="wp-block-paragraph">It seems to have gone up by a certain amount.</p>



<p class="wp-block-paragraph">you know it was like a negative blah blah blah 836 and then negative blah blah blah 708 so it</p>



<p class="wp-block-paragraph">kind of increased in value all right that&#8217;s a little bit helpful now it&#8217;s a really good uh</p>



<p class="wp-block-paragraph">place to uh print our decision points so anytime in your code where you have an if or an else or</p>



<p class="wp-block-paragraph">a function call or anything where you are kind of like you know making a decision or processing your</p>



<p class="wp-block-paragraph">data in some way it&#8217;s probably a good idea to announce your decisions so i could say up here i</p>



<p class="wp-block-paragraph">say up here i can go maybe i&#8217;ll say uh main first four and then i&#8217;ll call it uh maybe i&#8217;ll do a</p>



<p class="wp-block-paragraph">double colon there and i&#8217;ll say top if just to make it easy to read that i&#8217;m kind of like at</p>



<p class="wp-block-paragraph">the first if statement um maybe i&#8217;ll even put parentheses i&#8217;ll say a is more than 20 just to</p>



<p class="wp-block-paragraph">kind of like name what i&#8217;m actually doing and then i could replace the a with the actual value of a</p>



<p class="wp-block-paragraph">actual value of a so i could say a like that and maybe uh when i&#8217;m reading this later i might want</p>



<p class="wp-block-paragraph">to kind of actually see the variable name so i could say uh you could just like put a as a string</p>



<p class="wp-block-paragraph">and then maybe its value in parentheses or something like that do a new line um and then</p>



<p class="wp-block-paragraph">maybe after that top thing i&#8217;ll say uh true to indicate that we&#8217;re inside of the the if statement</p>



<p class="wp-block-paragraph">the if statement and then maybe at the bottom of that if statement we&#8217;ll just say</p>



<p class="wp-block-paragraph">a is now true and we&#8217;ll say like a is now you know whatever the new value of a was so just</p>



<p class="wp-block-paragraph">basically we&#8217;re announcing that we decided to go into this if block and then we announce what we</p>



<p class="wp-block-paragraph">ended up changing a to and also you probably anytime you see a compound expression like this</p>



<p class="wp-block-paragraph">You know B time something or a plus something or just you know a big part of multiple parts of the expression any expression</p>



<p class="wp-block-paragraph">That&#8217;s more than just like one variable or one number. It&#8217;s probably a good idea if you break that up into temporary variables, too</p>



<p class="wp-block-paragraph">and then</p>



<p class="wp-block-paragraph">Print out each variable and I know that&#8217;s a lot of stuff to read but again it beats debugging for an extra six hours</p>



<p class="wp-block-paragraph">I&#8217;m gonna leave that be for now though</p>



<p class="wp-block-paragraph">leave that be and</p>



<p class="wp-block-paragraph">I&#8217;m just gonna continue adding comments into the rest of the code. So I&#8217;m gonna do the second if block here</p>



<p class="wp-block-paragraph">So I&#8217;m going to do the second if block here.</p>



<p class="wp-block-paragraph">I&#8217;m going to say we&#8217;re in the first floor.</p>



<p class="wp-block-paragraph">We&#8217;re in the bottom if more than 20 true.</p>



<p class="wp-block-paragraph">And then we&#8217;ll print out what is the value of a after we&#8217;re finished.</p>



<p class="wp-block-paragraph">We&#8217;ll say a is now is now whatever value for a.</p>



<p class="wp-block-paragraph">And then I&#8217;ll do the same thing for this function call.</p>



<p class="wp-block-paragraph">Because, you know, when I call this function, it&#8217;s going to change the value somehow.</p>



<p class="wp-block-paragraph">So we&#8217;re going to do cout about to a plus equals f, you know, call to f.</p>



<p class="wp-block-paragraph">And then inside the arguments, I&#8217;m obviously putting i plus 3.</p>



<p class="wp-block-paragraph">But because i is a variable, we could just print that.</p>



<p class="wp-block-paragraph">So I&#8217;m going to do quote, quote, and then just stick the actual i in there.</p>



<p class="wp-block-paragraph">And then another new line.</p>



<p class="wp-block-paragraph">a finished a plus equals f and then I&#8217;ll just say you know a is now you know a you know print the</p>



<p class="wp-block-paragraph">new value of a you could also say a equal equal a and then print the value whatever you want but</p>



<p class="wp-block-paragraph">the point is I&#8217;m just printing everything here so now let&#8217;s go down a little bit more because</p>



<p class="wp-block-paragraph">there is a function call if you look at this function call down here here&#8217;s like some nonsense</p>



<p class="wp-block-paragraph">being used here&#8217;s some other like you know disabled code really what i&#8217;m doing at the</p>



<p class="wp-block-paragraph">very end is i&#8217;m just taking the input that the function received and i&#8217;m just multiplying it by</p>



<p class="wp-block-paragraph">two and returning it so again imagine that your code is a lot more complicated than this</p>



<p class="wp-block-paragraph">maybe input times two is actually input times two divided by three and then some other function</p>



<p class="wp-block-paragraph">call and then some other this and some other that and whatever so a lot of people will just kind of</p>



<p class="wp-block-paragraph">stuff like a really complicated expression in one line or one assignment or one return statement</p>



<p class="wp-block-paragraph">And that&#8217;s super confusing because you can&#8217;t really be sure that every part of the expression is as you thought.</p>



<p class="wp-block-paragraph">So it&#8217;s a really good idea to break it all up into parts and print each part.</p>



<p class="wp-block-paragraph">So you could imagine that we have like a C out here and we&#8217;ll say C out, you know, begin F.</p>



<p class="wp-block-paragraph">I&#8217;ll say like begin for F and then F receives an input of input.</p>



<p class="wp-block-paragraph">Do an end L.</p>



<p class="wp-block-paragraph">And then I&#8217;ll make a temporary variable here.</p>



<p class="wp-block-paragraph">variable here I&#8217;ll say int temp results equals input times two and then I&#8217;ll</p>



<p class="wp-block-paragraph">print that f and maybe I&#8217;ll do the input again</p>



<p class="wp-block-paragraph">temp result is now and then say temp result so I&#8217;m just gonna print what the</p>



<p class="wp-block-paragraph">temp result actually was and I could print something about I just multiplied</p>



<p class="wp-block-paragraph">thing about I just multiplied the input by two and then you know the more</p>



<p class="wp-block-paragraph">complicated your expression is the more temporary variables you want to use and</p>



<p class="wp-block-paragraph">just kind of print every single one of them and print you know this new</p>



<p class="wp-block-paragraph">variable is the result of dividing by two this new variable is the result of</p>



<p class="wp-block-paragraph">calling some other function and so forth</p>



<p class="wp-block-paragraph">so then we have like a basically you know basically a pretty good idea maybe</p>



<p class="wp-block-paragraph">at the end though instead of multiplying by two again you want to make it more</p>



<p class="wp-block-paragraph">want to make it more consistent with your debug output so like here temp result is obviously going</p>



<p class="wp-block-paragraph">to be the result that i return why would you do the expression all over again for the return part</p>



<p class="wp-block-paragraph">when you could easily get it wrong why not instead just return the temp result that you made right so</p>



<p class="wp-block-paragraph">then that way your output completely matches what you&#8217;re actually returning and for now i think</p>



<p class="wp-block-paragraph">that&#8217;s all we need to do let me run it one more time and then you&#8217;ll see a bunch of stuff now uh</p>



<p class="wp-block-paragraph">Now, we have a lot of information that we can use to trace how our program was thinking and hopefully find the problem.</p>



<p class="wp-block-paragraph">But isn&#8217;t this like a little bit starting to get a little bit hard to read, right?</p>



<p class="wp-block-paragraph">You can see that there are kind of blocks happening whenever we iterate.</p>



<p class="wp-block-paragraph">So, you know, for me, I always try to keep in mind you need all the brainpower you can get.</p>



<p class="wp-block-paragraph">Why not just format it a little bit better so it&#8217;s really easy to just quickly look at one block and see, you know,</p>



<p class="wp-block-paragraph">the couts kind of like belong together so i&#8217;m just going to add one more cout in the main for loop</p>



<p class="wp-block-paragraph">here just at the very bottom i&#8217;m going to go couts and l just so that i get a new line and if i run</p>



<p class="wp-block-paragraph">the program again notice how it&#8217;s easier to see the blocks like oh that&#8217;s clearly one iteration</p>



<p class="wp-block-paragraph">right here you know your mind just grabs onto it faster and that increases your brain power and</p>



<p class="wp-block-paragraph">makes it easier to debug and read the debug output so i can go all right all right okay so</p>



<p class="wp-block-paragraph">all right okay so we&#8217;re right up here oh around uh iteration um number 83 uh a was this number</p>



<p class="wp-block-paragraph">and then it got increased by uh this other number and the reason that that happened is because the</p>



<p class="wp-block-paragraph">function returned 172 so it basically increased it by 172 and then it ended up being that number</p>



<p class="wp-block-paragraph">oh okay i think i see what went wrong oh no right in this particular program if we scroll up just a</p>



<p class="wp-block-paragraph">little bit we can probably see that the integer is overflowing right the integer was getting bigger</p>



<p class="wp-block-paragraph">right the integer was getting bigger and bigger and bigger here and then eventually</p>



<p class="wp-block-paragraph">it jumped into the negative at some point so right here we can see oh okay when did this</p>



<p class="wp-block-paragraph">number become negative suppose we didn&#8217;t want it to be negative um what was this this is like</p>



<p class="wp-block-paragraph">a million this is a billion no wait wait wait this is uh no that&#8217;s a million right there so it&#8217;s like</p>



<p class="wp-block-paragraph">299 million and then it overflowed oh no no it didn&#8217;t it didn&#8217;t overflow it started at 299</p>



<p class="wp-block-paragraph">it started at 299 then at the bottom it was sitting at 899 million that&#8217;s kind of close to a billion</p>



<p class="wp-block-paragraph">and it did jump up from 300 million to 900 million so that&#8217;s a jump up of like 600 million</p>



<p class="wp-block-paragraph">oh you know it&#8217;s like kind of jumping up faster with each iteration oh and i&#8217;m using a 32-bit</p>



<p class="wp-block-paragraph">signed integer which has a maximum value of around 2 billion so now i could possibly realize at this</p>



<p class="wp-block-paragraph">the number is just like it became too big and I need to change my data type or I need to change</p>



<p class="wp-block-paragraph">my algorithm for some reason right so you can kind of get to the bottom of things pretty quickly</p>



<p class="wp-block-paragraph">so here&#8217;s another problem that people encounter when they&#8217;re using caveman debugging</p>



<p class="wp-block-paragraph">basically you you add all these cout statements or print statements or whatever you&#8217;re doing in</p>



<p class="wp-block-paragraph">whatever language you have and then when you&#8217;re finished you&#8217;re kind of like well I guess uh</p>



<p class="wp-block-paragraph">I need to delete all of these Couts because I don&#8217;t want all this you know</p>



<p class="wp-block-paragraph">Junk being printed in my program after I fix the problem or maybe you&#8217;re trying to debug a different part of your program</p>



<p class="wp-block-paragraph">So then you start commenting out all the print statements or you start</p>



<p class="wp-block-paragraph">You know deleting them or whatever and then whoops later on you realize maybe that part of my program</p>



<p class="wp-block-paragraph">Was not actually fixed and I have to add all the Couts all over again from scratch that costs time</p>



<p class="wp-block-paragraph">So that&#8217;s not fun. So here&#8217;s a trick that I like to use. It&#8217;s called a short circuit</p>



<p class="wp-block-paragraph">it&#8217;s called a short circuit it&#8217;s a sort of like a beginning C++ thing or just</p>



<p class="wp-block-paragraph">when you&#8217;re first learning how to use logical operators for boolean</p>



<p class="wp-block-paragraph">expressions so I&#8217;m gonna do a boolean and I&#8217;m just gonna name it after what</p>



<p class="wp-block-paragraph">problem I&#8217;m trying to solve so we could just call this you know main C outs or</p>



<p class="wp-block-paragraph">something like that let&#8217;s I don&#8217;t know primary problem I&#8217;ll call it primary</p>



<p class="wp-block-paragraph">the boolean as true because then what will happen is uh we can then short circuit all of the cout</p>



<p class="wp-block-paragraph">statements we can say primary problem couts and cout like that and the way the short circuit works</p>



<p class="wp-block-paragraph">works is if you have a logical and expression you can see right here we have two sides</p>



<p class="wp-block-paragraph">of that statement now one&#8217;s on the left which is just the boolean and one&#8217;s on the right which is</p>



<p class="wp-block-paragraph">have a logical and then you know one and zero is equal to zero true and false is equal to false so</p>



<p class="wp-block-paragraph">both things have to be true for the expression to evaluate to true which means if the first thing</p>



<p class="wp-block-paragraph">is false there&#8217;s no point in even looking at the second thing at all because if i if i set that to</p>



<p class="wp-block-paragraph">false then the second part the c out is it doesn&#8217;t matter the whole expression is going to evaluate</p>



<p class="wp-block-paragraph">to false anyway so uh the logical operator itself will just you know block out the rest of the</p>



<p class="wp-block-paragraph">you know, block out the rest of the statement.</p>



<p class="wp-block-paragraph">That&#8217;s called a short circuit.</p>



<p class="wp-block-paragraph">So I&#8217;m going to copy the short circuiting to all of my C out statements like this.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">And do that.</p>



<p class="wp-block-paragraph">And then the C out there.</p>



<p class="wp-block-paragraph">And I guess I&#8217;ll leave the final result there.</p>



<p class="wp-block-paragraph">And for the moment, you know, this is just a regular function.</p>



<p class="wp-block-paragraph">apply the short circuiting to this other f unless I do a separate boolean but</p>



<p class="wp-block-paragraph">keep in mind if this was a class and you had two different methods that you</p>



<p class="wp-block-paragraph">wanted to short circuit see outs inside of at the same time you could just use a</p>



<p class="wp-block-paragraph">member variable and name it after the problem you&#8217;re currently trying to solve</p>



<p class="wp-block-paragraph">and then just short circuit each see out in the appropriate method with that</p>



<p class="wp-block-paragraph">boolean so I guess in this regular program that doesn&#8217;t have a class I</p>



<p class="wp-block-paragraph">could move the boolean into the global if I wanted to but I&#8217;m not going to right</p>



<p class="wp-block-paragraph">if I wanted to, but I&#8217;m not going to right now.</p>



<p class="wp-block-paragraph">And if you&#8217;re writing assembly or some simpler language</p>



<p class="wp-block-paragraph">and you&#8217;re thinking, hey, I can&#8217;t short circuit an assembly</p>



<p class="wp-block-paragraph">or some other language, well, you could write a function</p>



<p class="wp-block-paragraph">that just takes a couple arguments.</p>



<p class="wp-block-paragraph">You could write a function that takes a string to print</p>



<p class="wp-block-paragraph">and maybe a number to print or just, you know,</p>



<p class="wp-block-paragraph">something simple like that.</p>



<p class="wp-block-paragraph">And then in the function itself that prints,</p>



<p class="wp-block-paragraph">you could call it debug print if you want.</p>



<p class="wp-block-paragraph">Have it look at a global variable or define</p>



<p class="wp-block-paragraph">that you&#8217;ve set up at the top of the assembly module.</p>



<p class="wp-block-paragraph">set up at the top of the assembly module, which you can just turn on and off,</p>



<p class="wp-block-paragraph">like just do a data byte and set it to a zero or set it to a one.</p>



<p class="wp-block-paragraph">And then the function debug print will just look at that variable to decide</p>



<p class="wp-block-paragraph">whether or not it&#8217;s going to actually print or not.</p>



<p class="wp-block-paragraph">So, you know, it&#8217;s a little more complicated in assembly,</p>



<p class="wp-block-paragraph">but you can do it basically the same concept.</p>



<p class="wp-block-paragraph">Let&#8217;s run this again just to make sure it still works.</p>



<p class="wp-block-paragraph">Okay, so it still works.</p>



<p class="wp-block-paragraph">So now suppose I want to turn off all the Cout statements.</p>



<p class="wp-block-paragraph">If I just change the true to false,</p>



<p class="wp-block-paragraph">the true to false notice how it&#8217;s all gone except for the stuff inside of f which i told you i</p>



<p class="wp-block-paragraph">wasn&#8217;t going to touch but notice how easy it was to mute it and then if i want to bring it back</p>



<p class="wp-block-paragraph">later i just go true to unmute it of course if you want to do a little bit more typing you can</p>



<p class="wp-block-paragraph">also do if statements like if this condition is true and that condition is true then print the</p>



<p class="wp-block-paragraph">debug statement so then you can have a more complicated way of muting and not muting but</p>



<p class="wp-block-paragraph">I&#8217;m going to leave it as is right now.</p>



<p class="wp-block-paragraph">Let&#8217;s see, what else do we got here?</p>



<p class="wp-block-paragraph">I think actually at this point, this is the basic idea of caveman debugging.</p>



<p class="wp-block-paragraph">Just basically print everything.</p>



<p class="wp-block-paragraph">Print all of your decision points.</p>



<p class="wp-block-paragraph">Use pretty labels that are really, really easy for you to understand.</p>



<p class="wp-block-paragraph">Use formatting so that your brain doesn&#8217;t have to struggle to understand what you&#8217;re seeing.</p>



<p class="wp-block-paragraph">If you just print a bunch of numbers, you&#8217;re going to be shooting yourself in the foot.</p>



<p class="wp-block-paragraph">you&#8217;re going to be shooting yourself in the foot and use short circuiting or if statements to</p>



<p class="wp-block-paragraph">selectively mute them so you can do less typing and and debugging the debugging and so forth but</p>



<p class="wp-block-paragraph">yeah i think i think this is all i really wanted to show you in this particular video</p>



<p class="wp-block-paragraph">i hope you feel like an expert in caveman debugging i certainly am and it you know it</p>



<p class="wp-block-paragraph">kind of fits my personality a little bit i&#8217;m like what&#8217;s going on um and like i said before</p>



<p class="wp-block-paragraph">debugger it&#8217;s probably a better idea but I usually don&#8217;t unless I&#8217;m in big trouble</p>



<p class="wp-block-paragraph">and I have a huge mess on my hands I usually just go directly to caveman</p>



<p class="wp-block-paragraph">debugging we&#8217;ll look at the same piece of code in my next video that I&#8217;m going</p>



<p class="wp-block-paragraph">to publish which is going to talk about using a proper debugger so watch the</p>



<p class="wp-block-paragraph">next one also but for now I hope you&#8217;ve enjoyed this video thank you for</p>



<p class="wp-block-paragraph">watching I hope you learned a little bit and had a little bit of fun see you in</p>



<p class="wp-block-paragraph">video</p>



<p class="wp-block-paragraph">whoops what the heck</p>



<p class="wp-block-paragraph">hey everybody thanks for watching this video again from the bottom of my heart</p>



<p class="wp-block-paragraph">i really appreciate it i do hope you did learn something and have</p>



<p class="wp-block-paragraph">some fun uh if you could do me a please a small little favor could you please</p>



<p class="wp-block-paragraph">subscribe and follow this channel or these videos</p>



<p class="wp-block-paragraph">or whatever it is you do on the current social media website that you&#8217;re looking</p>



<p class="wp-block-paragraph">at right now it would really mean the world to me and</p>



<p class="wp-block-paragraph">more videos and grow this community so we&#8217;ll be able to do more videos longer</p>



<p class="wp-block-paragraph">videos better videos or just I&#8217;ll be able to keep making videos in general so</p>



<p class="wp-block-paragraph">please do do me a kindness and and subscribe you know sometimes I&#8217;m</p>



<p class="wp-block-paragraph">sleeping in the middle of the night and I just wake up because I know somebody</p>



<p class="wp-block-paragraph">subscribed or followed it just wakes me up and I get filled with joy that&#8217;s</p>



<p class="wp-block-paragraph">exactly what happens every single time so you could do it as a nice favor to me</p>



<p class="wp-block-paragraph">or you could you control me if you want to just wake me up in the middle of the</p>



<p class="wp-block-paragraph">and then i&#8217;ll i&#8217;ll just wake up i promise that&#8217;s what will happen also uh if you look at the middle</p>



<p class="wp-block-paragraph">of the screen right now you should see a qr code which you can scan in order to go to the website</p>



<p class="wp-block-paragraph">which i think is also named somewhere at the bottom of this video and it&#8217;ll take you to my</p>



<p class="wp-block-paragraph">main website where you can just kind of like see all the videos i published and the services and</p>



<p class="wp-block-paragraph">tutorials and things that i offer and all that good stuff and uh if you have a suggestion for</p>



<p class="wp-block-paragraph">clarifications or errata or just future videos that you want to see please leave a comment or</p>



<p class="wp-block-paragraph">if you just want to say hey what&#8217;s up what&#8217;s going on you know just send me a comment whatever i also</p>



<p class="wp-block-paragraph">wake up for those in the middle of the night i get i wake up in a cold sweat and i&#8217;m like</p>



<p class="wp-block-paragraph">it would really it really mean the world to me i would really appreciate it so again thank you so</p>



<p class="wp-block-paragraph">much for watching this video and um enjoy the cool music as as i fade into the darkness which is</p>



<p class="wp-block-paragraph">us all.</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/caveman-debugging-simple-trick-to-debug-c-code-like-a-pro/">Caveman Debugging: Simple Trick to Debug C++ Code Like a Pro!</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/caveman-debugging-simple-trick-to-debug-c-code-like-a-pro/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>How to Convert Decimal to Hexadecimal: Fun &#038; Easy Guide for Beginners</title>
		<link>https://www.NeuralLantern.com/how-to-convert-decimal-to-hexadecimal-fun-easy-guide-for-beginners/</link>
					<comments>https://www.NeuralLantern.com/how-to-convert-decimal-to-hexadecimal-fun-easy-guide-for-beginners/#respond</comments>
		
		<dc:creator><![CDATA[mike]]></dc:creator>
		<pubDate>Sun, 13 Apr 2025 00:54:33 +0000</pubDate>
				<category><![CDATA[Computer Science]]></category>
		<category><![CDATA[Conversions]]></category>
		<category><![CDATA[Videos]]></category>
		<category><![CDATA[beginner programming]]></category>
		<category><![CDATA[binary to hex]]></category>
		<category><![CDATA[coding for beginners]]></category>
		<category><![CDATA[coding tips]]></category>
		<category><![CDATA[coding tutorial]]></category>
		<category><![CDATA[computer science]]></category>
		<category><![CDATA[decimal to hexadecimal]]></category>
		<category><![CDATA[hex explained]]></category>
		<category><![CDATA[hexadecimal conversion]]></category>
		<category><![CDATA[learn to code]]></category>
		<category><![CDATA[math for coding]]></category>
		<category><![CDATA[number systems]]></category>
		<category><![CDATA[programming basics]]></category>
		<category><![CDATA[tech tutorials]]></category>
		<guid isPermaLink="false">https://www.NeuralLantern.com/?p=88</guid>

					<description><![CDATA[<p>"Hexadecimal uses 0-9 and A-F to represent 16 values, making it shorter than binary. Learn to convert decimal to hex with this fun, step-by-step guide!</p>
<p>The post <a href="https://www.NeuralLantern.com/how-to-convert-decimal-to-hexadecimal-fun-easy-guide-for-beginners/">How to Convert Decimal to Hexadecimal: Fun &amp; Easy Guide for Beginners</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-embed is-type-wp-embed is-provider-rumble-com wp-block-embed-rumble-com"><div class="wp-block-embed__wrapper">
<iframe loading="lazy" class="wp-embedded-content" sandbox="allow-scripts" security="restricted" title="How to Convert Decimal to Hexadecimal: Fun &amp; Easy Guide for Beginners" src="https://rumble.com/embed/v6ptsuf/#?secret=pWTtkdDlLf" data-secret="pWTtkdDlLf" width="1000" height="563" frameborder="0"></iframe>
</div></figure>



<p class="wp-block-paragraph">Want to master decimal-to-hexadecimal conversion? Join me in this fun, beginner-friendly tutorial where we break it down with clear examples?like turning 223 into 0xDF! From number systems to handy calculator tricks, I?ll guide you step-by-step, no stress. Bonus: my dog makes a cameo! Perfect for coding newbies or anyone curious about hex. Subscribe for more easy tech tutorials, and let me know what you want to learn next! #DecimalToHex #CodingBasics #LearnToCode</p>



<p class="wp-block-paragraph">Introduction 00:00:00<br>Number Systems Overview 00:00:12<br>Decimal vs. Hexadecimal 00:00:39<br>Hexadecimal Digits Explained 00:01:06<br>Conversion Process Introduction 00:01:40<br>First Conversion Example Start 00:02:10<br>Handling Remainders 00:02:38<br>Dog Interruption 00:03:16<br>Continuing First Conversion 00:03:43<br>Finalizing First Conversion 00:06:04<br>Reversing Digits Order 00:06:24<br>Mapping Numbers to Hex Letters 00:07:34<br>Verifying First Conversion 00:08:48<br>Hexadecimal Prefix Importance 00:10:57<br>Second Conversion Example (223) 00:11:34<br>Third Conversion Example (2816) 00:13:32<br>Hex and Binary Relationship 00:14:56<br>Padding Zeros in Hex 00:16:07<br>Video Conclusion 00:16:58</p>



<p class="wp-block-paragraph">Thanks for watching!</p>



<p class="wp-block-paragraph">Find us on other social media here:</p>



<ul class="wp-block-list">
<li>https://www.NeuralLantern.com/social</li>
</ul>



<p class="wp-block-paragraph">Please help support us!</p>



<ul class="wp-block-list">
<li>Subscribing + Sharing on Social Media</li>



<li>Leaving a comment or suggestion</li>



<li>Subscribing to our Blog</li>



<li>Watching the main &#8220;pinned&#8221; video of this channel for offers and extras</li>
</ul>



<p class="wp-block-paragraph">Hello there.</p>



<p class="wp-block-paragraph">Let&#8217;s talk about converting decimal to hexadecimal.</p>



<p class="wp-block-paragraph">Hopefully you&#8217;ve watched my other videos by now, but basically we have different number</p>



<p class="wp-block-paragraph">systems, number bases that we can use.</p>



<p class="wp-block-paragraph">We have decimal, which is a base 10.</p>



<p class="wp-block-paragraph">which is base 10 or sorry base 16.</p>



<p class="wp-block-paragraph">We can basically convert back and forth between all of these systems.</p>



<p class="wp-block-paragraph">We can represent the exact same number just in different ways.</p>



<p class="wp-block-paragraph">Just as a quick refresher.</p>



<p class="wp-block-paragraph">Decimal, we can have characters that are 0 through 9, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.</p>



<p class="wp-block-paragraph">That&#8217;s 10 total characters.</p>



<p class="wp-block-paragraph">That&#8217;s why it&#8217;s base 10.</p>



<p class="wp-block-paragraph">In binary, we have, you know, just characters 0 and 1.</p>



<p class="wp-block-paragraph">characters 0 and 1 and in hexadecimal it&#8217;s meant to compact the representation a little bit it has</p>



<p class="wp-block-paragraph">more characters or more possible characters per digit than decimal so the number is going to be</p>



<p class="wp-block-paragraph">a little bit shorter usually unless it&#8217;s like very very small than decimal and it&#8217;ll be a lot shorter</p>



<p class="wp-block-paragraph">than the same number in binary so in hexadecimal we start off with 0 1 2 3 4 5 6 7 8 9</p>



<p class="wp-block-paragraph">three, four, five, six, seven, eight, nine.</p>



<p class="wp-block-paragraph">And then to get the remaining digits, we just go A, B, C, D, E, F.</p>



<p class="wp-block-paragraph">So we have this many characters.</p>



<p class="wp-block-paragraph">It&#8217;s 16 total characters.</p>



<p class="wp-block-paragraph">We can represent a number between 0 and 15.</p>



<p class="wp-block-paragraph">So that&#8217;s a difference between, you know, hexadecimal and decimal.</p>



<p class="wp-block-paragraph">Now let&#8217;s learn how to actually convert.</p>



<p class="wp-block-paragraph">So I&#8217;m going to start off with a number.</p>



<p class="wp-block-paragraph">I&#8217;m just going to type like a random number here.</p>



<p class="wp-block-paragraph">Hopefully this doesn&#8217;t go on for too long, the conversion.</p>



<p class="wp-block-paragraph">decimal number is just that. How do we convert? If you watch my other videos, it&#8217;s basically the</p>



<p class="wp-block-paragraph">same thing as converting from decimal to binary, except instead of dividing by two, because binary</p>



<p class="wp-block-paragraph">is base two, we&#8217;ll divide by 16 because hex is base 16. So I&#8217;m going to start off by saying,</p>



<p class="wp-block-paragraph">let&#8217;s take the original number and we&#8217;ll divide it by not two, 16. What does that equal? There&#8217;s</p>



<p class="wp-block-paragraph">no way I&#8217;m doing this in my head. So I&#8217;m just going to use a calculator for every single step,</p>



<p class="wp-block-paragraph">going to use a calculator for every single step not even going to try I&#8217;m</p>



<p class="wp-block-paragraph">going to say this number divided by 16 is 5 1 1 7 5 7 with some sort of a</p>



<p class="wp-block-paragraph">remainder so I&#8217;m gonna go 5 1 1 7 5 7 remainder something so in most</p>



<p class="wp-block-paragraph">calculators you can just punch up the modulo operator which is like the</p>



<p class="wp-block-paragraph">percent symbol before I do that I just want to point out 0.75 is 3 4ths of</p>



<p class="wp-block-paragraph">of whatever it is that is one you know that one character can represent we know</p>



<p class="wp-block-paragraph">we can represent 16 different values what&#8217;s 16 divided by 4 that&#8217;s 4 so three</p>



<p class="wp-block-paragraph">of those should be like 12 I hope unless I&#8217;m saying something totally wrong so</p>



<p class="wp-block-paragraph">I&#8217;m gonna do modulo so that&#8217;s 12 okay remainder 12 my dog is growling at me</p>



<p class="wp-block-paragraph">He likes to lie about peeing.</p>



<p class="wp-block-paragraph">He doesn&#8217;t actually pee.</p>



<p class="wp-block-paragraph">He already did a huge pee and then three times after that at 20 minute intervals, he went</p>



<p class="wp-block-paragraph">out there and lifted his leg and just like three squirts came out and he expected a giant</p>



<p class="wp-block-paragraph">treat for it.</p>



<p class="wp-block-paragraph">I&#8217;m not doing it.</p>



<p class="wp-block-paragraph">You&#8217;re not getting that treat.</p>



<p class="wp-block-paragraph">I expect a big pee pee if you want a treat.</p>



<p class="wp-block-paragraph">You dog?</p>



<p class="wp-block-paragraph">Dang little dog.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So, here we are still dividing.</p>



<p class="wp-block-paragraph">here we are still dividing. I got the remainder. So then we just need to take, you know, the</p>



<p class="wp-block-paragraph">quotient result, you know, what is the result of actually dividing, just carry it over to</p>



<p class="wp-block-paragraph">the next line. I&#8217;m going to do some spaces to make it look all even and continue to divide.</p>



<p class="wp-block-paragraph">So divided by 16 equals something. Don&#8217;t forget that if you have the modulo operator over there,</p>



<p class="wp-block-paragraph">you got to take it out, go back to division. It&#8217;s going to be 31984 remainder something.</p>



<p class="wp-block-paragraph">what&#8217;s the remainder i&#8217;m just going to get the modulo i don&#8217;t want i don&#8217;t want to recall what</p>



<p class="wp-block-paragraph">0.8125 is i&#8217;m sure some of you out there can already do that but it is 13 remainder 13.</p>



<p class="wp-block-paragraph">um so i&#8217;m gonna go 319 divided by 16 31984 divided by 16 so it&#8217;s going to be 1 999 okay so carry that</p>



<p class="wp-block-paragraph">over real fast though divided by 16 equals 1 9 9 remainder something there&#8217;s no decimal point at the</p>



<p class="wp-block-paragraph">There&#8217;s no decimal point at the end of that so I can just assume the remainder is going to be zero.</p>



<p class="wp-block-paragraph">If you want to double check to be sure, which is a good idea, use the modulo operator.</p>



<p class="wp-block-paragraph">If your calculator doesn&#8217;t have modulo, find another calculator or jump into Python or something.</p>



<p class="wp-block-paragraph">So I&#8217;m going to carry over 199 to the next line there.</p>



<p class="wp-block-paragraph">1, 2, 4, remainder, whatever modulo says, 15.</p>



<p class="wp-block-paragraph">That&#8217;s pretty cool.</p>



<p class="wp-block-paragraph">All right, then I&#8217;m gonna carry it over,</p>



<p class="wp-block-paragraph">just 1, 2, 4, divided by 16 again.</p>



<p class="wp-block-paragraph">If you were hoping I&#8217;d be able to do it in my head by now,</p>



<p class="wp-block-paragraph">you were wrong.</p>



<p class="wp-block-paragraph">1, 2, 4, divided by 16, it&#8217;s gonna be 7.75,</p>



<p class="wp-block-paragraph">so just like seven, remainder something.</p>



<p class="wp-block-paragraph">What did I say last time for the 3 4ths?</p>



<p class="wp-block-paragraph">Was that 12?</p>



<p class="wp-block-paragraph">whoops, I can&#8217;t remember anymore.</p>



<p class="wp-block-paragraph">12, yeah, okay, so remainder 12.</p>



<p class="wp-block-paragraph">And then we&#8217;ll carry it over and we&#8217;ll say 7 divided by 16.</p>



<p class="wp-block-paragraph">So we know that, you know, 16 doesn&#8217;t really fit into 7 at all.</p>



<p class="wp-block-paragraph">So it&#8217;s going to be 0 remainder, whatever the number is.</p>



<p class="wp-block-paragraph">Let&#8217;s punch it here just to double check.</p>



<p class="wp-block-paragraph">We&#8217;ll say 7 divided by 16.</p>



<p class="wp-block-paragraph">You can see that it&#8217;s 0.</p>



<p class="wp-block-paragraph">And then the remainder is going to be 7, just, you know, what the original number was.</p>



<p class="wp-block-paragraph">number was. So now at this point when the actual you know carry down quotient is</p>



<p class="wp-block-paragraph">going to be zero then we just have zero divided by 16 equals just zero remainder</p>



<p class="wp-block-paragraph">zero and it&#8217;ll just continue like this forever and ever and ever and ever and</p>



<p class="wp-block-paragraph">ever. So this is how you know you&#8217;re done. Another thing that I mentioned in</p>



<p class="wp-block-paragraph">other videos is how do we actually know where the zeros belong? I mean if you</p>



<p class="wp-block-paragraph">read this intuitively from the top to the bottom you might think that you know</p>



<p class="wp-block-paragraph">you know the top number is going to be like the first digit but it&#8217;s actually</p>



<p class="wp-block-paragraph">backwards it goes from the bottom up the reason you can know that is again based</p>



<p class="wp-block-paragraph">on my other videos if we just type a random decimal number here if I add</p>



<p class="wp-block-paragraph">zeros to the right side I&#8217;m actually changing the value of the number I&#8217;m</p>



<p class="wp-block-paragraph">making it bigger but if I add zeros to the left side I&#8217;m not changing the value</p>



<p class="wp-block-paragraph">at all so that means those zeros here which could go on for infinity based on</p>



<p class="wp-block-paragraph">how much tenacity you have they should be on the left side because you don&#8217;t</p>



<p class="wp-block-paragraph">side because you don&#8217;t want any amount of these zeros to change the value of your number because</p>



<p class="wp-block-paragraph">they you know it&#8217;s an arbitrary number of zeros based on how how fast you get tired of doing zeros</p>



<p class="wp-block-paragraph">so that means if i go from top to bottom i have to reverse it if i go from bottom to top it&#8217;s</p>



<p class="wp-block-paragraph">already going to be in the right order or sorry if i if i correlate or if i map bottom to top to mean</p>



<p class="wp-block-paragraph">left to right then it&#8217;s fine already if i map top to bottom for left to right then i&#8217;ll have to</p>



<p class="wp-block-paragraph">For left to right, then I&#8217;ll have to reverse it when I&#8217;m done.</p>



<p class="wp-block-paragraph">So I&#8217;ll do it both ways just to show you.</p>



<p class="wp-block-paragraph">But there&#8217;s one more step we need to do because in hexadecimal,</p>



<p class="wp-block-paragraph">we have more characters than decimal.</p>



<p class="wp-block-paragraph">We have to translate what does this 12 and 13 and these other numbers mean.</p>



<p class="wp-block-paragraph">Luckily, we had some of them in there.</p>



<p class="wp-block-paragraph">It could have been too easy.</p>



<p class="wp-block-paragraph">So remember in hex, we have 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.</p>



<p class="wp-block-paragraph">And then we have A, B, C, D, E, right?</p>



<p class="wp-block-paragraph">So we know that the value of 0 is 0 and 1 is 1 and 2 and 2 and so forth, right?</p>



<p class="wp-block-paragraph">Like 9 is 9.</p>



<p class="wp-block-paragraph">But what&#8217;s the value of A?</p>



<p class="wp-block-paragraph">For each increasing digit, the value just goes up by 1.</p>



<p class="wp-block-paragraph">So that means that A is worth 10.</p>



<p class="wp-block-paragraph">I&#8217;m going to write this vertically just so that you understand that this means the strength</p>



<p class="wp-block-paragraph">of the A is 10.</p>



<p class="wp-block-paragraph">And then the strength of the B is going to be 11 because it just increases by 1.</p>



<p class="wp-block-paragraph">The strength of the C is 12.</p>



<p class="wp-block-paragraph">The strength of the D is 13.</p>



<p class="wp-block-paragraph">Oops, I forgot the F.</p>



<p class="wp-block-paragraph">Oops, I forgot the F. Hit F in the chat if you forgot the F too.</p>



<p class="wp-block-paragraph">So the strength of the E is 14. The strength of the F is 15.</p>



<p class="wp-block-paragraph">And then we&#8217;re done. And remember, there&#8217;s 16 digits total.</p>



<p class="wp-block-paragraph">So the highest value is 15 because it includes the zero.</p>



<p class="wp-block-paragraph">So, you know, 16 total possible values you could represent, but the highest value, 15.</p>



<p class="wp-block-paragraph">So that means every time we see a 12 here,</p>



<p class="wp-block-paragraph">say that that&#8217;s really a C and every time we see actually let me let me put</p>



<p class="wp-block-paragraph">the other C in there real fast every time we see a 13 that means it&#8217;s a D</p>



<p class="wp-block-paragraph">every time we see a zero zero through nine it just it means the original</p>



<p class="wp-block-paragraph">number oh wow we only had two digits that are gonna mean the original number</p>



<p class="wp-block-paragraph">so mark my words you know the 15 is gonna be an F every time you see zero</p>



<p class="wp-block-paragraph">one two three four five six seven eight nine it maps to the same number so seven</p>



<p class="wp-block-paragraph">maps to seven it&#8217;s totally fine the only time it maps to a letter is of course when you exceed nine</p>



<p class="wp-block-paragraph">so 10 and above are going to map to letters so now i have these mappings i just need to sort of scan</p>



<p class="wp-block-paragraph">uh my my work to come up with the correct hexadecimal number so i&#8217;ll start from top to</p>



<p class="wp-block-paragraph">bottom because it&#8217;s a little bit harder that way and it&#8217;ll be more brain practice i&#8217;m going to go</p>



<p class="wp-block-paragraph">and then you know as many zeros as you decided to calculate and hopefully this</p>



<p class="wp-block-paragraph">reminds you oh no I&#8217;m increasing the value by adding the zeros that means I</p>



<p class="wp-block-paragraph">have to reverse everything so I&#8217;m gonna get rid of these zeros though and I&#8217;m</p>



<p class="wp-block-paragraph">gonna reverse it 7cf0dc okay great now let&#8217;s double check because it&#8217;s always</p>



<p class="wp-block-paragraph">a great idea to check your work in different ways with different methods to</p>



<p class="wp-block-paragraph">decrease the possibility that you&#8217;re accidentally wrong so now I&#8217;m gonna go</p>



<p class="wp-block-paragraph">So now I&#8217;m going to go from bottom to top and see if it&#8217;s the same thing.</p>



<p class="wp-block-paragraph">7 C F 0 D C. Does it match? Yes.</p>



<p class="wp-block-paragraph">So now I&#8217;m pretty confident that I have the right answer.</p>



<p class="wp-block-paragraph">Let me punch this up in my personal calculator real fast.</p>



<p class="wp-block-paragraph">I&#8217;m going to do just to double check the work before we cut the camera,</p>



<p class="wp-block-paragraph">because if I&#8217;m wrong, I want to be able to correct myself right away.</p>



<p class="wp-block-paragraph">Instead of coming back with another video later,</p>



<p class="wp-block-paragraph">which sometimes I guess I&#8217;ll have to do.</p>



<p class="wp-block-paragraph">f0 dc is the correct answer all right so we now have converted our first number from decimal to</p>



<p class="wp-block-paragraph">hexadecimal nice and by the way if you didn&#8217;t already know this you&#8217;re supposed to put a</p>



<p class="wp-block-paragraph">prefix in front of hexadecimal numbers not necessarily in every program that asks for</p>



<p class="wp-block-paragraph">hex input some of them are not programmed that way but in general when you expect someone to</p>



<p class="wp-block-paragraph">read your numbers if it&#8217;s hex you want to put ox in front of it because you don&#8217;t want them to</p>



<p class="wp-block-paragraph">confuse, let&#8217;s say we have this number and this number and this number. All three of those could</p>



<p class="wp-block-paragraph">be a different number depending on whether they&#8217;re binary or decimal or hex. But if you put the</p>



<p class="wp-block-paragraph">symbols in front, this is binary, this is hex, then now the reader knows that these are three</p>



<p class="wp-block-paragraph">different numbers and they can infer what the numbers mean. Okay, so let me, let&#8217;s just do like</p>



<p class="wp-block-paragraph">another number. We&#8217;ll make it a little bit smaller so it&#8217;s easier. We&#8217;ll say decimal and we&#8217;ll go two,</p>



<p class="wp-block-paragraph">and we&#8217;ll go 2 2 3.</p>



<p class="wp-block-paragraph">So it&#8217;s faster.</p>



<p class="wp-block-paragraph">So we start off with 2 2 3,</p>



<p class="wp-block-paragraph">we divide it by 16,</p>



<p class="wp-block-paragraph">and that&#8217;s going to be something.</p>



<p class="wp-block-paragraph">So 2 2 3 divided by 16</p>



<p class="wp-block-paragraph">is going to be 13 remainder something.</p>



<p class="wp-block-paragraph">I&#8217;m going to do the modulo operator.</p>



<p class="wp-block-paragraph">And by the way,</p>



<p class="wp-block-paragraph">if you don&#8217;t have a modulo operator</p>



<p class="wp-block-paragraph">and you can&#8217;t figure out a better way to do this,</p>



<p class="wp-block-paragraph">a good trick is to just say,</p>



<p class="wp-block-paragraph">let&#8217;s take 13,</p>



<p class="wp-block-paragraph">because that was the answer, right?</p>



<p class="wp-block-paragraph">13 point something.</p>



<p class="wp-block-paragraph">We&#8217;ll take 13 and multiply that by 16 again,</p>



<p class="wp-block-paragraph">that by 16 again so it goes higher then take the difference between that and the original number</p>



<p class="wp-block-paragraph">so we can say 223 minus uh the number multiplied back up and it&#8217;ll tell us that our remainder is 15.</p>



<p class="wp-block-paragraph">let&#8217;s see was that actually the remainder let me just double check here oh gosh what am i doing</p>



<p class="wp-block-paragraph">223 modulo 16 15 yeah there it is if you&#8217;re lazy like me you could also do something like this i</p>



<p class="wp-block-paragraph">and I don&#8217;t have a modulo.</p>



<p class="wp-block-paragraph">I&#8217;ll do 13 times 16 and it&#8217;s 208.</p>



<p class="wp-block-paragraph">And then I&#8217;ll just subtract the original number</p>



<p class="wp-block-paragraph">and then we get negative 15,</p>



<p class="wp-block-paragraph">but then I know it&#8217;s not negative, I know it&#8217;s 15.</p>



<p class="wp-block-paragraph">So it&#8217;s just like, it makes you a little bit faster</p>



<p class="wp-block-paragraph">in the calculator.</p>



<p class="wp-block-paragraph">So this number I think was too small</p>



<p class="wp-block-paragraph">because we just do 13 and then divide that by 16.</p>



<p class="wp-block-paragraph">Obviously the answer is gonna be zero remainder 13.</p>



<p class="wp-block-paragraph">And we just have a two digit hexadecimal number.</p>



<p class="wp-block-paragraph">digit hexadecimal number. Let&#8217;s do that real fast. What is 15 going to be? It&#8217;s A and no, no,</p>



<p class="wp-block-paragraph">no, not A. Sorry. That&#8217;s F. Subtract two from that. D E F. So it&#8217;s going to be D, I think.</p>



<p class="wp-block-paragraph">So then if we go from bottom to top, it&#8217;s going to be O X D F. Let me double check that I&#8217;m</p>



<p class="wp-block-paragraph">telling you the right thing. 223 D F. Okay. So we got it right. Let&#8217;s do something just like a</p>



<p class="wp-block-paragraph">not as difficult as the first one so I&#8217;ll try four digits maybe two two two two</p>



<p class="wp-block-paragraph">how about that four digital four digital digits how about that we&#8217;ll do</p>



<p class="wp-block-paragraph">two eight one six divided by 13 equals something two eight one six divided by</p>



<p class="wp-block-paragraph">16 that&#8217;s 176 remainder something there&#8217;s no decimal point so I can just</p>



<p class="wp-block-paragraph">16 is 176 divided by 16 is 11.</p>



<p class="wp-block-paragraph">Another zero remainder.</p>



<p class="wp-block-paragraph">Getting kind of boring though, isn&#8217;t it?</p>



<p class="wp-block-paragraph">Remainder zero.</p>



<p class="wp-block-paragraph">And then we&#8217;ll do 11 divided by 16.</p>



<p class="wp-block-paragraph">That&#8217;s going to be zero remainder 11.</p>



<p class="wp-block-paragraph">That&#8217;s too easy.</p>



<p class="wp-block-paragraph">Okay.</p>



<p class="wp-block-paragraph">So what is zero?</p>



<p class="wp-block-paragraph">Zero is zero.</p>



<p class="wp-block-paragraph">You&#8217;re welcome.</p>



<p class="wp-block-paragraph">And then what is zero?</p>



<p class="wp-block-paragraph">It&#8217;s also zero.</p>



<p class="wp-block-paragraph">0, it&#8217;s also 0 and then what is 11? That&#8217;s B.</p>



<p class="wp-block-paragraph">So we should have a number now of 0xB00 if we&#8217;re going from the bottom to the top.</p>



<p class="wp-block-paragraph">If you go from the top to the bottom of course it&#8217;ll be 00B and then you reverse it B00</p>



<p class="wp-block-paragraph">but I just wanted to skip that step for now.</p>



<p class="wp-block-paragraph">Let me punch this up into my personal calculator to make sure I don&#8217;t need to make a correction.</p>



<p class="wp-block-paragraph">B00, there we go.</p>



<p class="wp-block-paragraph">Also, you know, here&#8217;s another thing to keep in mind.</p>



<p class="wp-block-paragraph">it&#8217;s to read you know sets of bytes which typically go in patterns of one byte or two</p>



<p class="wp-block-paragraph">bytes or four bytes or eight bytes or whatever so the cool thing about hex is one character</p>



<p class="wp-block-paragraph">can represent a number from zero uh to 15 or 16 combinations and if you think about that in binary</p>



<p class="wp-block-paragraph">that&#8217;s four bits right it&#8217;s like one two three four one two four eight multiply eight by two</p>



<p class="wp-block-paragraph">16 subtract 1 is 15.</p>



<p class="wp-block-paragraph">So you can go from 0 to 15.</p>



<p class="wp-block-paragraph">So that means for every character in hex,</p>



<p class="wp-block-paragraph">you get four characters of binary.</p>



<p class="wp-block-paragraph">So it&#8217;s like a huge savings, right?</p>



<p class="wp-block-paragraph">But the point is, if you wanted to represent one byte,</p>



<p class="wp-block-paragraph">that&#8217;s not going to be four bits.</p>



<p class="wp-block-paragraph">That&#8217;s going to be, you know,</p>



<p class="wp-block-paragraph">four bits followed by four bits for a total of eight bits.</p>



<p class="wp-block-paragraph">Even if there are zeros in the beginning,</p>



<p class="wp-block-paragraph">in binary, if you&#8217;re representing a byte,</p>



<p class="wp-block-paragraph">But in binary, if you&#8217;re representing a byte, you typically want to pad the zeros to the</p>



<p class="wp-block-paragraph">left so that it looks like it&#8217;s aligned to nice blocks of eight or 16 or 32 or 64 in</p>



<p class="wp-block-paragraph">terms of bits.</p>



<p class="wp-block-paragraph">So we should do the same thing with hex.</p>



<p class="wp-block-paragraph">We should always have two hex digits together.</p>



<p class="wp-block-paragraph">We should try not to have like an odd number of hex digits.</p>



<p class="wp-block-paragraph">And if you want to get more strict than that and say like, oh, only, you know, two or four</p>



<p class="wp-block-paragraph">eight you can do that but i just will say pad it with a zero to the left remember when you pad a</p>



<p class="wp-block-paragraph">number with zeros to the left it doesn&#8217;t change the value like if i just put a bunch of zeros in</p>



<p class="wp-block-paragraph">front of this decimal number it wouldn&#8217;t change the value so we can do that with hex and it looks</p>



<p class="wp-block-paragraph">nicer and neater and people can quickly see okay so there&#8217;s like a byte right there it&#8217;s ob</p>



<p class="wp-block-paragraph">they can imagine oh that byte is probably um 11. so there&#8217;s like a like an 11 byte it&#8217;s like got</p>



<p class="wp-block-paragraph">a sequence of zeros and ones and then there&#8217;s another byte right after it which is smaller</p>



<p class="wp-block-paragraph">which is smaller, which just has zeros.</p>



<p class="wp-block-paragraph">So it just helps the reader visualize what&#8217;s going on.</p>



<p class="wp-block-paragraph">Okay, I&#8217;m going to cut the video here.</p>



<p class="wp-block-paragraph">I hope you enjoyed this video.</p>



<p class="wp-block-paragraph">I hope you learned a little bit of stuff and had a little bit of fun.</p>



<p class="wp-block-paragraph">I&#8217;ll see you in the next video.</p>



<p class="wp-block-paragraph">Hey, everybody.</p>



<p class="wp-block-paragraph">Thanks for watching this video again from the bottom of my heart.</p>



<p class="wp-block-paragraph">I really appreciate it.</p>



<p class="wp-block-paragraph">I do hope you did learn something and have some fun.</p>



<p class="wp-block-paragraph">If you could do me a please, a small little favor,</p>



<p class="wp-block-paragraph">please a small little favor could you please subscribe and follow this channel</p>



<p class="wp-block-paragraph">or these videos or whatever it is you do on the current social media website</p>



<p class="wp-block-paragraph">that you&#8217;re looking at right now it would really mean the world to me and</p>



<p class="wp-block-paragraph">it&#8217;ll help make more videos and grow this community so we&#8217;ll be able to do</p>



<p class="wp-block-paragraph">more videos longer videos better videos or just I&#8217;ll be able to keep making</p>



<p class="wp-block-paragraph">videos in general so please do do me a kindness and and subscribe you know</p>



<p class="wp-block-paragraph">sometimes I&#8217;m sleeping in the middle of the night and I just wake up because I</p>



<p class="wp-block-paragraph">And I just wake up because I know somebody subscribed or followed.</p>



<p class="wp-block-paragraph">It just wakes me up and I get filled with joy.</p>



<p class="wp-block-paragraph">That&#8217;s exactly what happens every single time.</p>



<p class="wp-block-paragraph">So you could do it as a nice favor to me or you could troll me if you want to just wake me up in the middle of the night.</p>



<p class="wp-block-paragraph">Just subscribe and then I&#8217;ll just wake up.</p>



<p class="wp-block-paragraph">I promise that&#8217;s what will happen.</p>



<p class="wp-block-paragraph">Also, if you look at the middle of the screen right now, you should see a QR code,</p>



<p class="wp-block-paragraph">which you can scan in order to go to the website, which I think is also named somewhere at the bottom of this video.</p>



<p class="wp-block-paragraph">where you can just kind of like see all the videos I published and the services</p>



<p class="wp-block-paragraph">and tutorials and things that I offer and all that good stuff and if you have</p>



<p class="wp-block-paragraph">a suggestion for clarifications or errata or just future videos that you</p>



<p class="wp-block-paragraph">want to see please leave a comment or if you just want to say hey what&#8217;s up</p>



<p class="wp-block-paragraph">what&#8217;s going on you know just send me a comment whatever I also wake up for</p>



<p class="wp-block-paragraph">those in the middle of the night I get I wake up in a cold sweat I&#8217;m like this</p>



<p class="wp-block-paragraph">really it really mean the world to me I would really appreciate it so again thank you so much</p>



<p class="wp-block-paragraph">for watching this video and enjoy the cool music as as I fade into the darkness which is coming for</p>



<p class="wp-block-paragraph">us all</p>



<p class="wp-block-paragraph">Thank you.</p>
<p>The post <a href="https://www.NeuralLantern.com/how-to-convert-decimal-to-hexadecimal-fun-easy-guide-for-beginners/">How to Convert Decimal to Hexadecimal: Fun &amp; Easy Guide for Beginners</a> appeared first on <a href="https://www.NeuralLantern.com">NeuralLantern.com</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.NeuralLantern.com/how-to-convert-decimal-to-hexadecimal-fun-easy-guide-for-beginners/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
