2

Ok, so i'm doing some exercise from a book, and I saw this declaration

float f, const c =9.9;

Initially, I thought this would be a compiler error, but I went into VS2013 and tested this, and it did not throw an error. I could even modify the c variable after declaration. I would like to know why and how is this possible,what is the compiler even doing with the const keyword in this case?

Ryncops
  • 189
  • 1
  • 14

1 Answers1

1

I would like to know why and how is this possible,what is the compiler even doing with the const keyword in this case?

It's not compiling it. Not with C++14, nor C++11, nor C++03, not even C.

Shoe
  • 74,840
  • 36
  • 166
  • 272