wow.... 101% same statement by me.... awesome.... :-) exactly same... actually, he gave a big smile after this. so i thought it is wrong that why he is smiling. :p yoo!! and these concepts are only because of daniweb. no issues.
You are returning a reference to a local variable - not good! Even though the elements of arr are allocated on the heap (malloc()), arr itself is not. This would work if you made it static, but the fact of the matter is that this is REALLY bad code! Rethink your approach.