I am making this program with the following criteria:
Create a C++ program that does the following:
• Create an array of 5 integers and initialize it.
• Create an external function that accepts a memory address that points to an integer element of the above array.
Add 5 to the passed value.
• Output the contents of the array.
I am getting errors and I have no idea why.
Errors:
CODE
error C3861: 'func': identifier not found
error C2365: 'func' : redefinition; previous definition was 'formerly unknown identifier'
CODE
#include <iostream>
using namespace std;
int main()
{
int arr1[5] = { 23, 14, 26, 21, 19 };
func(arr1);
for(int j=0; j<5; j++)
cout << arr1[j] << " ";
cout << endl;
int x;
cin >> x;
return 0;
}
//--------------------------------------------------------------------------------
void func(int* arry)
{
arry += 5;
}