I've got a question to C structs and datatypes. I have a struct called test
:
struct test
{
char* c;
char* c2;
};
And I am returning this struct from a function:
struct test a()
{
struct test t = { "yeah!", "string" };
return t;
}
My question is whether the memory for the struct is freed automatically or if I have to do this manually via free()
.
[update from comment:]
The function a is in a DLL and I want to use the struct in the main program.