# Array of Pointers to Structs

Instructor: David Gloag
The need to manipulate groupings of dissimilar information is important in computer programming. In this lesson, we'll take a look at arrays, pointers, and structs, what they are, and when we might use them together.

## Collect and Use

We often collect groupings of related information. We see this in tax forms that ask for contact information, we see it in questionnaires that collect related facts and opinions, and we see it in weather reports that collect related meteorological data. So, it will come as no surprise that computer programs mimic this strategy in order to manipulate information. But how is this done? How do computer programs represent the information in an ordered fashion so that it can be easily worked on? Many techniques are used. And none are more important than arrays, pointers, and structs.

## What is an Array?

An array is a list of elements. Each element in the list is the same, and each can be accessed by its position, or index, in the list. When we say each element is the same, we mean its makeup, but not necessarily its content. For example, consider a phone list. The list is an array of name-phone number pairs. Each pair has the same components, a name and phone number. But, each is unique. One might be for your work, another might be for your significant other. Regardless, we treat them all as a unit.

## What is a Pointer?

Simply put, a pointer is a memory location that gives access to another memory location. This indirect idea gives problems to many people who are new to the concept. It is one of the most misunderstood concepts in computer science. As an example, consider a sign along the road that says ''Hospital 2 miles.'' The sign doesn't say the hospital is here. Instead, it says go this way, 2 miles, and you will get to the hospital. It points you in the right direction. This is what a pointer does. It doesn't contain the actual data of interest itself. Rather, it says go here if you want to find what you are after.

## What is a Struct?

The term struct is short for structure, and it is a collection of related pieces of information. Each of the pieces can stand on its own, but they don't represent the structure when considered individually. If you think back to the phone number list mentioned above. Each name-phone number pair is a structure. They have the same makeup, but their content is likely unique. We can extend this idea to more complex groupings. Name, street address, city, state or province, and postal or zip code, are often grouped into what we call contact information. We do this because it allows us to think about, and manipulate, the group of information as a whole.

To unlock this lesson you must be a Study.com Member.

### Register to view this lesson

Are you a student or a teacher?

#### See for yourself why 30 million people use Study.com

##### Become a Study.com member and start learning now.
Back
What teachers are saying about Study.com

### Earning College Credit

Did you know… We have over 200 college courses that prepare you to earn credit by exam that is accepted by over 1,500 colleges and universities. You can test out of the first two years of college and save thousands off your degree. Anyone can earn credit-by-exam regardless of age or education level.