View Single Post
Old 04-18-2005, 07:05 AM   #1 (permalink)
lostromos
Registered User
 
Join Date: Apr 2005
Posts: 5
lostromos is on a distinguished road
Function returning pointer

Hi everybody,

I think i have a complete mess in my head and i would be grateful if smb could clarify things a little.

All i want from a function is to give me back a dynamic array. But i cannot easy manipulate what this function returns. So, lets say :
int * getArray(void) { return Array;}
Somewhere in my prog, i have the following:
int * MyArray = getArray();
Now i'm wondering: If ever Array changes, MyArray will change either?

If it's the case (if with a "get" function that returns a dynamic array i dont get a constant result but a variable one, depending on "Array") then how else can i force a function to return a dynamic array whose values will stay always the same?

I hope i was clear with my question, although it's not clear at all in my head.

Thanks for your patience,

George
lostromos is offline   Reply With Quote