Making an array of even numbers out of another array
What I have to do is make a function that will make an array of even numbers out of another array of ints that is inputted by the user. Here is the function that I have so far... Sorry if it is absolutely horrible. I suck with arrays so badly, and i'm pretty new at it.
Code:
void distributeEven(int array[])
{
int counter = 0,
array2[10],
arrayCounter = 0;
for (counter; counter < 10; counter++)
{
if (array[counter] % 2 == 0)
{
array2[arrayCounter] = array[counter];
}
arrayCounter++;
}
}
I know its horrible and probably has many problems, one of them being that I don't know how to make it return values into the array when i'm calling it.
I thank you for any help that you can afford me