Why does the size of a class depends on the order of the member declaration? and How?
<p>Someone explain me how does the order of the member declaration inside a class determines the size of that class.</p>

<p>For Example :</p>

<pre><code>class temp
{
public:
    int i;
    short s;
    char c;
};
</code></pre>

<p>The size of above class is 8 bytes.</p>

<p>But when the order of the member declaration is changed as below</p>

<pre><code>class temp
{
public:
    char c;
    int i;
    short s;
};
</code></pre>

<p>then the size of class is 12 bytes.</p>

<p>How?</p>
