6. Dynamic Variables

Overview

This chapter introduces dynamic variables—that is, variables that can be created when needed and can hold an arbitrarily large amount of data, limited only by the amount of memory available. By the end of this chapter, you will be able to describe why dynamic variables are important; create dynamic variables and arrays; describe the difference between the stack and the heap; refer to dynamic variables and arrays through pointers; delete dynamic variables and arrays and create linked data structures using pointers.

Introduction

All the basic kinds of variables, arrays, and structs introduced so far have a fixed size that is known at compile time. Fixed-size variables have many advantages; they can be laid end ...

Get The C++ Workshop now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.