A data structure requires memory allocated for it.
Some data structures (such as a string or character vector) have internal logic in their class that allocates memory dynamically as needed.
Arrays (which come from C) are not needed - you need to allocate memory for them manually, either in a static way (char c [128]), as your example, or dynamically at runtime via malloc () and company, of course, make the correct allocation / redistribution of rights is not very simple and why you need to do this when there are already classes (for example, a string) that do this for you in the right way? :)
source share