Why doesn’t C++ support Variable-Length Array?
Variable-Length Array (VLAs) are not part of the C++ standard because they were not included in the original C++98 standard. The C++ language is based on C, and VLAs were not part of the C standard at the time. Additionally, the C++ standardization committee has chosen to focus on other features and improvements, such as templates and the Standard Template Library (STL), rather than adding VLAs to the language. Some C++ compilers support VLAs as an extension to the language, but they are not a standard feature.
GFact | Why doesn’t C++ have Variable Length Arrays library?
While studying DSA, we all have encountered Arrays and their fixed-size property. But have you ever thought about Why C language allows us the Variable-Length Array but C++ doesn’t? And what should we do in C++ if we want a Variable-Length Array?
Well, we will talk about the above in detail in the following post but first, we should know about the term Variable-length Array.