In my answer to this question it was mentioned that the code I posted wouldn't work if the variable was declared as const
.
What if i want to initialize a long array that's const
type
int main (){
const int ar[100];
//this is invalid in c++
//something like this
for (int i=0;i <100;++i)
ar[i]=i;
return 0;
}
Are there other ways to do this than using the #define
method proposed in that question?