I need to code a function in which i declare a new array and then i need that array to stay in the memory...
I was wondering which is the best programming practice to attain this result, and i would also love to understand how does the garbage collector work in this specific situation
More in the case, if i declare a function and inside it i inizializate an array, if i keep the reference to the address outside the function, Once the function as finished working, and it's enviroment cease to exist, will the Array still be usable, or do i risk that further malloc or array declaration would unexpectdly override my previuos array?
also, if i use a malloc inside a function, will the memory allocated stay reserved untill i free it no matter where i do use the malloc?
Thanks for the help anyone will offer.