You also cannot return an array allocated within a function. This is very unsafe. It should be ever allocated dynamically inside a function or copied to an outside target.