Wouldn't the line with malloc(); lead to a memory leak? You're not freeing it.
Why in the world would I free that memory within the function itself?
The whole point of allocating on the heap is so that the function returns a valid pointer.
DtY
Posted: Fri May 22, 2009 7:01 am Post subject: RE:Translations from Turing
Yes, I know if you freed it inside that function the pointer would be useless, but you never free that memory.
DemonWasp
Posted: Fri May 22, 2009 11:00 am Post subject: RE:Translations from Turing
He has a point. In your main(), you should be capturing that pointer and freeing it properly, but you're not. Probably a non-issue since the program ends immediately but better style regardless.