• Advertisement
Sign in to follow this  

const

This topic is 4923 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Thinking in C++ says that this code is Illegal. However, when I put this code and compile it in DEVC++ i don't get an error. I don't know why it would be illegal. Is thinking in C++ wrong? //: C08:Constag.cpp // Constants and aggregates const int i[] = { 1, 2, 3, 4 }; //! float f[i[3]]; // Illegal struct S { int i, j; }; const S s[] = { { 1, 2 }, { 3, 4 } }; //! double d[s[1].j]; // Illegal int main() {} ///:~

Share this post


Link to post
Share on other sites
Advertisement
Are you compiling the code exactly as you typed it? Because the illegal expressions are commmented out...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement