take a look
Code:
#include <iostream>
using namespace std;

void input (int test[5])
{
int i;
for(i=0;i<5;i++)
{
cout<<"Enter a number: ";
cin>>test[i];
}
}
int main()
{
int array[5];
input(array);
for(int i=0;i<5;i++)
{
cout<<array[i]; //shows the same values that i have input using the //function
cout<<endl;
}
return 0;
}

I am passing array to function but it is being passed by reference..Could you please explain this concept?
Why is this being passed as reference even though i am not using & operator to pass it as reference. I wrote a bubble sort algorithm using the same concept and i passed the array to function and did not return anything but it sorted the array in my main function which is weird as i did not pass the array by reference. I passed it like in the above program.
Could you guys please explain this?I've been trying to find answer on Google but haven't been able to find it yet.Hopefully you guys can help.