Chapter 1

Structures and Arrays

IN THIS CHAPTER

Bullet Using structures to store and retrieve data

Bullet Creating and working with arrays

Bullet Using resizable arrays

Bullet Running multidimensional arrays

Bullet Combining structures with arrays

Bullet Detailing the drawbacks of arrays

All programs need to store data. If a program asks the user to type in their name, the program needs to store that name somewhere so it can find the name again. The most common way programs store data is to dump data in a variable.

Unfortunately, a simple variable can hold only one chunk of data at a time, such as a single number or a single name. If you want to store a person’s first and last name along with their age, you have to create three separate variables, like this:

Dim FirstName As StringDim LastName As StringDim Age As Integer

Creating separate variables to store related data can be like carrying around three separate wallets ...

Get Beginning Programming All-in-One For Dummies, 2nd Edition 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.