<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>C on Institute of Ineptitude</title><link>https://ineptitude.ca/tags/c/</link><description>Recent content in C on Institute of Ineptitude</description><generator>Hugo -- 0.153.1</generator><language>en</language><lastBuildDate>Sat, 06 Dec 2025 21:41:18 -0700</lastBuildDate><atom:link href="https://ineptitude.ca/tags/c/index.xml" rel="self" type="application/rss+xml"/><item><title>Condition Evaluation Utility</title><link>https://ineptitude.ca/writing/condition-evaluation-utility/</link><pubDate>Sat, 06 Dec 2025 21:41:18 -0700</pubDate><guid>https://ineptitude.ca/writing/condition-evaluation-utility/</guid><description>&lt;p&gt;After you run a command in UNIX shell (bourne, bash, etc), &lt;code&gt;$?&lt;/code&gt; has
the exit code (return value) of the prior run command:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-sh-session" data-lang="sh-session"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="go"&gt; $? Expands to the exit status of the most recent pipeline.
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Shell scripting is a bit &lt;em&gt;weird&lt;/em&gt; in that the return value of a program
is evaluated as &lt;code&gt;true&lt;/code&gt; if it&amp;rsquo;s &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;false&lt;/code&gt; if it&amp;rsquo;s &lt;code&gt;non-zero.&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;This is useful as by convention unix commands return &lt;code&gt;0&lt;/code&gt; on success
or any other integer code to map to specific error conditions.&lt;/p&gt;</description></item><item><title>ASCII case bit twiddling</title><link>https://ineptitude.ca/writing/ascii-case-bit-twiddling/</link><pubDate>Tue, 10 Dec 2024 21:49:28 -0700</pubDate><guid>https://ineptitude.ca/writing/ascii-case-bit-twiddling/</guid><description>&lt;p&gt;If you pay a special sort of attention, you may notice that the
upper-case and lower-case alphabet characters on the ASCII table
are always exactly offset from each other by 32.&lt;/p&gt;
&lt;p&gt;For example, upper-case &lt;code&gt;A&lt;/code&gt; is &lt;code&gt;65&lt;/code&gt;, while the lowercase &lt;code&gt;a&lt;/code&gt; is &lt;code&gt;97&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;As such the way the binary place value works out, you can manipulate
the case of a character by setting or clearing the sixth bit&amp;hellip;
(2^5 = 32, we start counting bits and everything at 0, we&amp;rsquo;re
programmers!)&lt;/p&gt;
&lt;p&gt;Decimal &lt;code&gt;32&lt;/code&gt; expressed as hexadecimal is &lt;code&gt;0x20&lt;/code&gt; and expressed as
binary is &lt;code&gt;00100000&lt;/code&gt;&lt;/p&gt;</description></item><item><title>Initialize your variables</title><link>https://ineptitude.ca/writing/init-your-vars/</link><pubDate>Sat, 17 Aug 2024 15:51:13 -0700</pubDate><guid>https://ineptitude.ca/writing/init-your-vars/</guid><description>&lt;p&gt;There&amp;rsquo;s no shortage of material that explains variables in C should
be initialized&amp;hellip; but I&amp;rsquo;ve often found the explanation of &lt;em&gt;why&lt;/em&gt; to
be somewhat lacking.&lt;/p&gt;
&lt;p&gt;Where do the initial values of a variable come from if you don&amp;rsquo;t
explicitly initialize?&lt;/p&gt;</description></item><item><title>Guess the number...</title><link>https://ineptitude.ca/writing/guess-the-number/</link><pubDate>Fri, 05 Apr 2024 00:00:00 +0000</pubDate><guid>https://ineptitude.ca/writing/guess-the-number/</guid><description>&lt;p&gt;A quick demonstration of how one can use a debugger to interactively inspect variables in a running program&amp;hellip;&lt;/p&gt;</description></item></channel></rss>