<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Syntax on Cheat Sheet</title><link>/tags/syntax/</link><description>Recent content in Syntax on Cheat Sheet</description><generator>Hugo</generator><language>en</language><atom:link href="/tags/syntax/index.xml" rel="self" type="application/rss+xml"/><item><title>Syntax Basics</title><link>/programming/c/syntax-basics/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/programming/c/syntax-basics/</guid><description>&lt;h1 id="syntax-basics"&gt;Syntax Basics&lt;a class="anchor" href="#syntax-basics"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;h2 id="declaration-vs-definition"&gt;Declaration vs. Definition&lt;a class="anchor" href="#declaration-vs-definition"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;p&gt;In C, declaration and definition are distinct compiler operations governing name resolution and memory allocation.&lt;/p&gt;
&lt;h3 id="declaration"&gt;Declaration&lt;a class="anchor" href="#declaration"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A declaration informs the compiler of the name and type of an entity without allocating storage.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Introduces an identifier to the compiler so it can perform type checking.&lt;/li&gt;
&lt;li&gt;An entity can be declared multiple times across translation units.&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="highlight"&gt;&lt;pre tabindex="0" style="background-color:#f7f7f7;-moz-tab-size:4;-o-tab-size:4;tab-size:4;-webkit-text-size-adjust:none;"&gt;&lt;code class="language-c" data-lang="c"&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#cf222e"&gt;extern&lt;/span&gt; &lt;span style="color:#cf222e"&gt;int&lt;/span&gt; x&lt;span style="color:#1f2328"&gt;;&lt;/span&gt; &lt;span style="color:#57606a"&gt;// Variable x is defined elsewhere; no storage allocated here
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="display:flex;"&gt;&lt;span&gt;&lt;span style="color:#cf222e"&gt;int&lt;/span&gt; &lt;span style="color:#6639ba"&gt;Func&lt;/span&gt;&lt;span style="color:#1f2328"&gt;(&lt;/span&gt;&lt;span style="color:#cf222e"&gt;int&lt;/span&gt; a&lt;span style="color:#1f2328"&gt;);&lt;/span&gt; &lt;span style="color:#57606a"&gt;// Function prototype declaration; no code generated
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;h3 id="definition"&gt;Definition&lt;a class="anchor" href="#definition"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;A definition provides the actual storage (for variables) or executable code (for functions).&lt;/p&gt;</description></item></channel></rss>