### Invalid types for array

Hello. I'm trying to compile this program and i have some strange issue that i can't fix. Please help me!
 ``1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859`` ``````#include using namespace std; int dividing(int * T, int N, int l, int p) { int Rn = 0; int Ln = 0; int * R = new int[N-1]; int * L = new int[N-1]; //if(N==1) return; for(int i=l; iT[i]) { L[Ln] = T[i]; Ln++; } else { R[Rn] = T[i]; Rn++; } } T[Ln+1]=T[0]; for(int i=0;i=1) { q = dividing(T, N, l, p); sort(T, N, l, q); sort(T, N, q+1, N); } } int main() { int T[7] = {3,5,2,1,6,7,8}; sort(T,7,0,7); for(int i=0;i<7;i++) cout << "[" << T[i] << "] "; }``````

 ```sortowanie.cpp: In function ‘int dividing(int*, int, int, int)’: sortowanie.cpp:29:16: error: invalid types ‘int[int]’ for array subscript sortowanie.cpp:33:16: error: invalid types ‘int[int]’ for array subscript ```

You will probably figure out what this program should do and i know this isn't good and i will probably have another problems with this but i want to try challenge them by myself so I ask you to help me only with this one error. Thanks.
Last edited on
Ln and Rn aren't arrays.
I think you meant to use L and R, and not Ln and Rn.
Thanks a lot. Next stupid mistake. This compiler outputs are really non-intuitive for me... I hope that one day i won't have that kind of problems. This program isn't working the way i want it to work and this time i will give up my idea. Thanks again.
Topic archived. No new replies allowed.