I know that you can't simply return an array from a function to main but since I'm so confused on pointers, I need to ask for help.
Here's basically a sketch of what I have:
Code:
int main (void)
{
int variable[3];
variable = GetArray();
}
int GetArray(void)
{
int array[3];
// do bunch of stuff here that fills the array
return array[0];
}
I end up with bunch of big numbers if I try to print the array on main, but when I print the array in "GetArray" function, they come out as they are supposed to.
How can I be able to do this successfully?