Returning an array from a function is kind of a daily job of a software engineer, but if you are beginner then you might do it wrong.
You can't just return the array from the function because it was created on stack and the moment function is returned the memory will be claimed and receiver end will try to access freed memory which is not good.
So the solution to this problem is that you can use the static array and then return that array that will not have any memory issue because static variable or array or object just get created once and will remain there till the program exist.
JOIN ME
/ @cppnuts
/ cppnuts
#cprogramming #interview #softwareengineer