> there are multiple problems. For one result[] = newMyObj() says "return what
> result points to" which however is not a pointer. More gravely though, even
> if it worked you would lose the just allocated pointer/memory because you
> would overwrite result with what MyObj() returns.
I do not really think so.
result[] = newMyObj()
Run
does copy the CONTENT of newMyObj() into result variable. So when he allocates
mem for result in a correct way with alloc() (I mentioned the sizeof bug) he
should have a valid pointer initialized to valid content, for example with x ==
42. Of course he is responsible for deallocation of that object.