I'm making a simple uC program to perform the Cartesian product and output the results for me.Currently the way I have it set up is that you input your x and y values in the setup() function, and it builds the Cartesian set (size : x*y by 2 array)

Anyhow, once that array is built, I want to pass it to my main function so that it displays the next value of the set everytime it receives a digital trigger on one of the lines.

My question to you is how do you pass an array from a function to the other? I've no experience in C++ and my function keeps giving me errors. I've asked a few friends, and they said that you can't pass arrays around, and it must be done through pointers. I can't make the variable global as I don't know the size of x and y before starting it.

Thanks for your answer. So when I declare it globally, how can I do it? Since I dont know its size, I get size undefined errors. If I just define it as a simple double, and not a array of double, only the first value is available in main()

If you truly want to create a variable sized array, you'll need to look at using malloc. The pointer to the (pointers to the) space that you allocate must still be global. The Arduino has a limited amount of memory, so dynamic memory allocation is generally to be avoided.

Creating a static array large enough for your most ambitious use is better, as long as that array fits in memory, with enough room left to run the rest of your program.