I have a function that returns a pointer to a custom struct I made:
struct CustomStruct * function1() {
// other stuff before this ...
struct CustomStruct cs = {param1, param2, param3};
struct CustomStruct *cs_p = &cs;
return cs_p;
then another function using the return value of this function:
void function2() {
struct CustomStruct *new_cs_p = function1();
but if I try printing the values in new_cs_p
I get weird characters. They print fine in function1 before I return them. Any idea as to what's causing this?