<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Functions on Cheat Sheet</title><link>/tags/functions/</link><description>Recent content in Functions on Cheat Sheet</description><generator>Hugo</generator><language>en</language><atom:link href="/tags/functions/index.xml" rel="self" type="application/rss+xml"/><item><title>Functions</title><link>/programming/cpp/primer/functions/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>/programming/cpp/primer/functions/</guid><description>&lt;h1 id="functions"&gt;Functions&lt;a class="anchor" href="#functions"&gt;#&lt;/a&gt;&lt;/h1&gt;
&lt;p&gt;Based on &lt;em&gt;C++ Primer, 5th ed.&lt;/em&gt; Chapter 6 (Functions).&lt;/p&gt;
&lt;p&gt;A function is a block of code with a name. Functions can be overloaded, meaning that the same name may refer to several different functions.&lt;/p&gt;
&lt;h2 id="1-object-lifetime-and-function-declarations"&gt;1. Object Lifetime and Function Declarations&lt;a class="anchor" href="#1-object-lifetime-and-function-declarations"&gt;#&lt;/a&gt;&lt;/h2&gt;
&lt;h3 id="automatic-objects"&gt;Automatic Objects&lt;a class="anchor" href="#automatic-objects"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;An automatic object is an object that exists only while a block is executing.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strong&gt;Parameters are automatic objects.&lt;/strong&gt; They are created (initialized) when the function is called and destroyed when the block is exited.&lt;/li&gt;
&lt;/ul&gt;
&lt;h3 id="local-static-objects"&gt;Local &lt;code&gt;static&lt;/code&gt; Objects&lt;a class="anchor" href="#local-static-objects"&gt;#&lt;/a&gt;&lt;/h3&gt;
&lt;p&gt;Each local &lt;code&gt;static&lt;/code&gt; object is initialized before the first time execution passes through the object&amp;rsquo;s definition.&lt;/p&gt;</description></item></channel></rss>