Everything I wish I knew when learning C
Some constructive feedback:<p><i>&gt; Here are the absolute essential flags you may need.</i><p>I highly recommend including `-fsanitize=address,undefined` in there (docs: <a href="https:&#x2F;&#x2F;gcc.gnu.org&#x2F;onlinedocs&#x2F;gcc&#x2F;Instrumentation-Options.html" rel="nofollow">https:&#x2F;&#x2F;gcc.gnu.org&#x2F;onlinedocs&#x2F;gcc&#x2F;Instrumentation-Options.h...</a>).<p>(Edit: But probably not in release builds, as @rmind points out.)<p><i>&gt; The closest thing to a convention I know of is that some people name types like my_type_t since many standard C types are like that</i><p>Beware that names beginning with &quot;int&quot;&#x2F;&quot;uint&quot; and ending with &quot;_t&quot; are reserved in &lt;stdint.h&gt;.<p>[Edited; I originally missed the part about &quot;beginning with int&#x2F;uint&quot;, and wrote the following incorrectly comment: &quot;That shouldn&#x27;t be recommended, because names ending with &quot;_t&quot; are reserved. (As of C23 they are only &quot;potentially reserved&quot;, which means they are only reserved if an implementation actually uses the name: <a href="https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;c&#x2F;language&#x2F;identifier" rel="nofollow">https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;c&#x2F;language&#x2F;identifier</a>. Previously, defining <i>any</i> typedef name ending with &quot;_t&quot; technically invokes undefined behaviour.)&quot;]<p>The post never mentions undefined behaviour, which I think is a big omission (especially for programmers coming from languages with array index checking).<p><i>&gt; void main() {</i><p>As @vmilner mentioned, this is non-standard (reference: <a href="https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;c&#x2F;language&#x2F;main_function" rel="nofollow">https:&#x2F;&#x2F;en.cppreference.com&#x2F;w&#x2F;c&#x2F;language&#x2F;main_function</a>). The correct declaration is either `int main(void)` or the argc+argv version.<p>(I must confess that I am guilty of using `int main()`, which is valid in C++ but technically not in C: <a href="https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;29190986&#x2F;is-int-main-without-void-valid-and-portable-in-iso-c" rel="nofollow">https:&#x2F;&#x2F;stackoverflow.com&#x2F;questions&#x2F;29190986&#x2F;is-int-main-wit...</a>).<p><i>&gt; You can cast T to const T, but not vice versa.</i><p>This is inaccurate. You can <i>implicitly convert</i> T* to const T*, but you need to use <i>an explicit cast</i> to convert from const T* to T*.