So... I am brand new to programming and I have a difficult problem I have not figure out yet.
So what I want to be able to do is input an array into a function, have the function do something to the array, and return the array to main(), so I can input the array into another function or something...
I have seen alot about pointers but I don't really understand how to implement something like that.
so the code would look something like this
Expand|Select|Wrap|Line Numbers
- include <iostream>
- include <cstdlib>
- using namespace std;
- int function(array[]);
- int main()
- {
- int array[10];
- function(array);
- return 0;
- }
- int function(array[])
- {
- for(int i = 0; i < 10; i++)
- {
- array[i] = i;
- }
- return(array[]); // apparently this can't be done...
- }