program crashing while returning from main
<pre><code>class A
{
public :
    void show()
    {
        cout &lt;&lt; " The values in Object are " &lt;&lt; i &lt;&lt; '\t' &lt;&lt; c  &lt;&lt; endl;
    }

    A() {}

    A (const A &amp;obj)
    {
        i = obj.i;
        c = (char *)malloc(strlen(obj.c));
        strcpy (c,obj.c);
    }

public :
    int i;
    char *c;
};

void func(A aa)
{
    cout &lt;&lt; " The values in Object are " &lt;&lt; aa.i &lt;&lt; '\t' &lt;&lt; aa.c  &lt;&lt; endl;
}

int main()
{
    A a;
    a.i = 10;
    a.c = "string";
    a.show();
    func(a);
    a.show();
    return 0;
}
</code></pre>

<p>I have tried with GDB and found that it crashes while returning from main, but I have no clue why it is being crashing.</p>
