0
class A{
    int V;
public:
    bool function(){
        bool ar[V];
    }
}

i am getting an 'this cannot be used in a constant expression' error at the V variable :bool ar[V];

Manik
  • 573
  • 1
  • 9
  • 28
Angel
  • 11
  • 2
  • 3
    C++ doesn't have [variable-length arrays](https://en.wikipedia.org/wiki/Variable-length_array). Array sizes must be compile-time constants. If the size is only known at run-time use `std::vector`. – Some programmer dude May 23 '20 at 20:02
  • [Why aren't variable-length arrays part of the C++ standard?](https://stackoverflow.com/questions/1887097/) – Remy Lebeau May 23 '20 at 20:26

0 Answers0