Hey so I want to declare an 2d array in one of my classes - it is first declared outside of any methods, and then set size by constructor
class xxx
int **triangle;
constructor(int n){
triangle = new int *[n+1];
for(int i=0;i<=n; i++) triangle[i]=new int[i+1];
}
but the first line of constructor does not work:
error: incompatible types in assignment of ‘int**’ to ‘int* [0]’
NVM it's fixed - I put int *triangle[]; in my header file.. 40 minutes wasted :D