Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
fuckwit12921yIn C array sizes have to be constant for the compiler to know how big that array is. try to put a 'const' before your variable that defines the size.
hashr9201yyou can use const keyword to define variable 'n'.
const int n = 100;
initializing const variable is compulsary
If you cannot use const you could fake it by defining the function as one dimensional and calculating the index by multiplying the first dimension by n and adding the second.
Its not very elegant code but it works.
The underlying problem is that thats basically what the compiler converts your code to, but without const as mentioned, the compiler does not know how long it should jump to reach the next row. So you have to do the calculation manually.