I tried to make a simple function that takes an array parameter and outputs it and it keeps giving me th error:
\function test.cpp(12) : error C2664: 'func' : cannot convert parameter 1 from 'int' to 'int []'
1> Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
Here is my program:
#include<iostream>
#include<string>
int func(int arr[])
{
return (arr[1]);
}
int arr[];
using namespace std;
int main()
{
cout<<func(1);
system("pause");
return 0;
}
I am really confused now to what it means when you have an array parameter like int func(arr[]) -does it define its length or the first parameters, how do you call it then?! HELP ME!
thank you.