Is it possible to increment the array passed to a function?
I have a single dimensional array a[4] = {10,20,30,40}, I want to call a function and increment the array to point to 3rd element and print it from main().
For ex:
int main()
{
int a[4] = {10,20,30,40};
cout << *a; // 10
increment(); // function call
cout << *a; // 40
}
How can we accomplish this?If array is passed as a pointer, only the modification to the value stored in array get reflected. What is the prototype of the function if we have to increment the array in function?