Hi, I think that I am having some conceptual problems with pointers. I have an Integer Array being created and used in a function, and I would like to return the array back into my main().
This would seem easy, but in the books they speak of using pointers instead of my array. Do I need to change it to a pointer and then return it? Please tell me what I have done wrong.
This is a sample program that does the same thing as I want.
Code:
int function()
{
int x1[4];
int a;
for(a = 0; a < 4; a++)
{
x1[a] = a;
}
return x1;
}
int main()
{
int x2[4];
x2 = function();
return 0;
}
Thanks a lot for your time!