2.2: Basic Data Structures
2.2.1: Arrays and Strings
Read this article, which explores the use of string arrays, which are part of C programming. C did not allow for the use of strings initially, so string arrays are simply a string of characters that are stored in an array. We haven't discussed arrays yet, but this is a great introduction to the use of character strings.
This is an additional explanation of character strings, or string arrays, for you to review. Each has a different way of explaining the concepts.
The String class is an extension that was added to the C++ language that deals with character strings as strings, not as arrays. Read this article to learn how to use classes to call methods and how to manipulate strings to access text data.
Read chapter 4 on pages 35-40 to learn about arrays that are not character arrays. This chapter explains how to declare arrays, maneuver them, and use them within classes.
Watch this video to learn about multidimensional arrays. In the chapter above, you learned about one-dimensional arrays. This video shows how to use multidimensional arrays.
Read this chapter, which highlights the many different functions that are part of the string class in C++.
Complete these exercises to check your understanding of string arrays.
2.2.2: Pointers
Sometimes, we need to keep track of where we've been or where we need to go. In this case, we use a pointer. Read this article to learn about the use of pointers.
Watch this video, which provides excellent examples of using pointers.
Complete these exercises to check your understanding of pointers.
2.2.3: Struct, Unions, and Enumerations
Enumerated types (enums) are essentially a series of int variables that represent more complex data types. Read this article to learn how to use enums.
Structs are a great way to pair multiple variables together and allow them to be passed as a group. Read this article to learn how to use structs.
Unions are very similar to structs; however, the data shares the same memory spaces, so they cannot be used at the same time. Read this article to learn more about unions.