What is C-style Array?

A C-Style array is just a “naked” array – that is, an array that’s not wrapped in a class, like this:

char[] array = {'a', 'b', 'c', ''};

Or a pointer if you use it as an array:

Thing* t = new Thing[size];
t[someindex].dosomething();

And a “C++ style array” (the unofficial but popular term) is just what you mention – a wrapper class likestd::vector (or std::array). That’s just a wrapper class (that’s really a C-style array underneath) that provides handy capabilities like bounds checking and size information.

Extracted from: Seth Carnegie’s Solution on StackOverflow

Advertisements