I keep getting "error invalid types 'int int ' for array subscript"
This is my code, any help is appreciated. #include <iostream> using namespace std; int i; int j; int k; int m; int n; int b; void product(int array[], int x=1) { for(i=0;i<m;i++) { for(j=0;j<n;j++) { for(k=0;k<b;k++) { x=x*array[i][j][k]; } } } cout<<"Product: "<<x<<endl; } void suma(int array[], int y=0) { for(i=0;i<m;i++) { for(j=0;j<n;j++) { for(k=0;k<b;k++) { y=y+array[i][j][k]; } } } cout<<"Sum: "<<y<<endl; } void numberElements(int array[], int z=0) { for(i=0;i<m;i++) { for(j=0;j<n;j++) { for(k=0;k<b;k++) { z=z+1; } } } cout<<"Total number of elements: "<<z<<endl; } int main() { int i, j, k, m, n, b, temp; int arr[m][n][b]; cout<<"Array dimensions:"<<endl; cin>>m>>n>>b; for(i=0;i<m;i++) { for(j=0;j<n;j++) { for(k=0;k<b;k++) { cout<<"Insert value on ["<<i<<"]["<<j<<"]["<<k<<"] "; cin>>arr[i][j][k]; } } } cout<<endl; cout<<"Array:"<<endl; for(i=0;i<m;i++) { for(j=0;j<n;j++) { for(k=0;k<b;k++) { cout<<arr[i][j][k]; } cout<<endl; } cout<<endl; } product(arr); sum(arr); numberElements(arr); return 0; }