Error compiling C++ code: 'invalid types 'int[int]'
I'm having some trouble trying to figure out why my C++ program won't compile. This is what I've currently written so far: #include <iostream> using namespace std; int main(){ int numofrot, arr, inc, inc2; cin >> arr >> numofrot; int array[arr]; for (inc = 1; inc < arr + 1; inc++){ array[arr] = inc; } for (inc = 0; inc < numofrot; inc++){ for (inc2 = 0; inc2 < arr; inc2++){ if (arr[inc2 + 1] > arr){ arr [inc2] = 1;} else arr[inc2] +=1; } } } return 0; } The compiler returns some errors that I can fix pretty easily, but asides from those, the main errors that are causing me problems are the following: ..\Playground\: In function 'int main()': ..\Playground\:15:29: error: invalid types 'int[int]' for array subscript if (arr[inc2 + 1] > arr){ ^ ..\Playground\:16:26: error: invalid types 'int[int]' for array subscript arr [inc2] = 1;} ^ ..\Playground\:17:30: error: invalid types 'int[int]' for array subscript else arr[inc2] +=1; I understand why these errors are happening, but I do not have the knowledge on how to fix them. Any and all assistance will be greatly appreciated!