Thanks for your reply.

I'm not using C++. The devices I am programming for have extremely limited memory (1024 - 4096 k), and dynamic memory allocation is a big no - no for me. The function was given to me as an example.