Name: Anonymous 2011-12-02 13:18
Consider the two snipits used to make a struct
would T2 produce memory errors later on in a program if used a lot? How would it know to when to cleanup a?
//T1
struct b *create_b(...)
{
struct b *a = malloc(sizeof(struct b));
...
return a;
}
//T2
struct b *create_b(...)
{
struct b a;
...
return &a;
}would T2 produce memory errors later on in a program if used a lot? How would it know to when to cleanup a?