<?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>operators | Learn C Games Programming Blog</title>
	<atom:link href="https://learncgames.com/tag/operators/feed/" rel="self" type="application/rss+xml" />
	<link>https://learncgames.com</link>
	<description>A blog about C, programming games and my ebook(s).</description>
	<lastBuildDate>Thu, 03 Nov 2022 19:47:01 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://learncgames.com/wp-content/uploads/2020/03/cropped-favicon-32x32.png</url>
	<title>operators | Learn C Games Programming Blog</title>
	<link>https://learncgames.com</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">181446779</site>	<item>
		<title>++/&#8211; Operators work on floats and doubles</title>
		<link>https://learncgames.com/operators-work-on-floats-and-doubles/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=operators-work-on-floats-and-doubles</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Fri, 04 Nov 2022 00:00:56 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Techniques]]></category>
		<category><![CDATA[operators]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=3088</guid>

					<description><![CDATA[<p>No matter how much I use C there are still things I thought I knew but find out otherwise. The latest one is that you can use ++ or &#8212; on float and double variables. Here for instance is a short nonsense program that I compiled and ran with Visual Studio on Windows. As you&#8217;#ll [&#8230;]</p>
The post <a href="https://learncgames.com/operators-work-on-floats-and-doubles/">++/– Operators work on floats and doubles</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<figure id="attachment_3089" aria-describedby="caption-attachment-3089" style="width: 300px" class="wp-caption alignleft"><a href="https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4.jpg"><img fetchpriority="high" decoding="async" class="size-medium wp-image-3089" src="https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4-300x169.jpg" alt="laptop computer with an editor" width="300" height="169" srcset="https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4-300x169.jpg 300w, https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4-1024x576.jpg 1024w, https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4-768x432.jpg 768w, https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4-1536x864.jpg 1536w, https://learncgames.com/wp-content/uploads/2022/11/vpoexr5wmr4.jpg 1600w" sizes="(max-width: 300px) 100vw, 300px" /></a><figcaption id="caption-attachment-3089" class="wp-caption-text">From Instant Images</figcaption></figure>
<p>No matter how much I use C there are still things I thought I knew but find out otherwise. The latest one is that you can use ++ or &#8212; on float and double variables.</p>
<p>Here for instance is a short nonsense program that I compiled and ran with Visual Studio on Windows. As you&#8217;#ll notice, it increments and decrements floats and a double.</p>
<p>The danger with using this is that you might get rounding errors. When I ran it on Windows, I didn&#8217;t which surprised me. I will have to try this on Linux.</p>
<pre><code class="language-c" data-line="">#include &lt;stdio.h&gt;

void main()
{
    float c = 1.0f;
    float cin = 10000.0f;
    double d = 2.0;
    int i = 0;

    while (cin != c)
    {
        i++;
        cin = c;
        c--;
        d++;
    }
    printf(&quot;%i %e %e\n&quot;, i, c, d);
}</code></pre>The post <a href="https://learncgames.com/operators-work-on-floats-and-doubles/">++/– Operators work on floats and doubles</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">3088</post-id>	</item>
		<item>
		<title>Useful reference to C operators</title>
		<link>https://learncgames.com/useful-reference-to-c-operators/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=useful-reference-to-c-operators</link>
		
		<dc:creator><![CDATA[David]]></dc:creator>
		<pubDate>Tue, 21 Jul 2020 23:00:49 +0000</pubDate>
				<category><![CDATA[C]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[operators]]></category>
		<guid isPermaLink="false">https://learncgames.com/?p=1024</guid>

					<description><![CDATA[<p>Ever wondered what all the operators that you can use = are. Like ^=. Or what about operator precedence? Does * come before ++? (Answer no, ++ is higher precedence than *). Do you know how a &#38; b == 7 is parsed? It&#8217;s actually a &#38; (b==7) This Wikipedia page lists all the operators with precedence order and [&#8230;]</p>
The post <a href="https://learncgames.com/useful-reference-to-c-operators/">Useful reference to C operators</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></description>
										<content:encoded><![CDATA[<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:614,&quot;href&quot;:&quot;https:\/\/pixabay.com\/users\/ElasticComputeFarm-1865639\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1147815&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20250718031443\/https:\/\/pixabay.com\/users\/elasticcomputefarm-1865639\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:42:14&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-10 05:41:11&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 04:27:14&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-24 01:37:01&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-05 14:06:28&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-11 21:23:44&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-17 08:22:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-21 05:42:06&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-02 15:16:09&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-05 23:05:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-09 09:31:26&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-13 04:49:33&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-18 13:55:07&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-22 05:36:11&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-22 05:36:11&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:615,&quot;href&quot;:&quot;https:\/\/pixabay.com\/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1147815&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260205102120\/https:\/\/pixabay.com\/?utm_source=link-attribution&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:42:24&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-10 05:41:13&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-17 04:27:14&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-24 01:37:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-02-28 11:05:38&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-05 14:06:29&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-11 21:23:44&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-17 08:22:03&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-03-21 05:42:06&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-02 15:16:10&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-05 23:05:12&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-09 09:31:24&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-13 04:49:26&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-18 13:55:06&quot;,&quot;http_code&quot;:403},{&quot;date&quot;:&quot;2026-04-22 05:36:10&quot;,&quot;http_code&quot;:403}],&quot;broken&quot;:true,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-04-22 05:36:10&quot;,&quot;http_code&quot;:403},&quot;process&quot;:&quot;done&quot;},{&quot;id&quot;:616,&quot;href&quot;:&quot;https:\/\/en.wikipedia.org\/wiki\/Operators_in_C_and_C%2B%2B&quot;,&quot;archived_href&quot;:&quot;http:\/\/web-wp.archive.org\/web\/20260206094007\/https:\/\/en.wikipedia.org\/wiki\/Operators_in_C_and_C%2B%2B&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[{&quot;date&quot;:&quot;2026-02-06 16:42:40&quot;,&quot;http_code&quot;:200}],&quot;broken&quot;:false,&quot;last_checked&quot;:{&quot;date&quot;:&quot;2026-02-06 16:42:40&quot;,&quot;http_code&quot;:200},&quot;process&quot;:&quot;done&quot;}]'></div>
<figure id="attachment_1025" aria-describedby="caption-attachment-1025" style="width: 300px" class="wp-caption alignleft"><img decoding="async" class="wp-image-1025 size-medium" src="https://learncgames.com/wp-content/uploads/2020/07/library-1147815_640-300x198.jpg" alt="Reference" width="300" height="198" srcset="https://learncgames.com/wp-content/uploads/2020/07/library-1147815_640-300x198.jpg 300w, https://learncgames.com/wp-content/uploads/2020/07/library-1147815_640.jpg 640w" sizes="(max-width: 300px) 100vw, 300px" /><figcaption id="caption-attachment-1025" class="wp-caption-text">Image by <a href="https://pixabay.com/users/ElasticComputeFarm-1865639/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1147815">ElasticComputeFarm</a> from <a href="https://pixabay.com/?utm_source=link-attribution&amp;utm_medium=referral&amp;utm_campaign=image&amp;utm_content=1147815">Pixabay</a></figcaption></figure>
<p>Ever wondered what all the operators that you can use = are. Like ^=. Or what about operator precedence? Does * come before ++? (<em>Answer no, ++ is higher precedence than *</em>).</p>
<p>Do you know how</p>
<pre><span class="n">a</span> <span class="o">&amp;</span> <span class="n">b</span> <span class="o">==</span> <span class="mi">7</span></pre>
<p>is parsed? It&#8217;s actually <strong>a &amp; (b==7</strong>)</p>
<p><a title="Link to Wikipedia page on C &amp; C++ operators" href="https://en.wikipedia.org/wiki/Operators_in_C_and_C%2B%2B" target="_blank" rel="nofollow noopener noreferrer">This Wikipedia page</a> lists all the operators with precedence order and as it includes C++, it lets you see what you can and can&#8217;t do in C and C++.  It&#8217;s worth bookmarking whenever you need to look these things up.</p>The post <a href="https://learncgames.com/useful-reference-to-c-operators/">Useful reference to C operators</a> first appeared on <a href="https://learncgames.com">Learn C Games Programming Blog</a>.]]></content:encoded>
					
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1024</post-id>	</item>
	</channel>
</rss>
