Copyright

Array of Pointers to Functions

Instructor: David Gloag

David has over 40 years of industry experience in software development and information technology and a bachelor of computer science

Programmers are constantly looking for ways to simplify, and modularize their programs. In this lesson, we'll take a look at arrays, pointers, and functions, what they are, and when we might use these programming features together.

Dealing with Complexity

Software today is complex. Desktop applications require millions of lines of code and many programmers to write, medical applications have similar characteristics and the ability to save lives if things work as expected, and military applications often have similar scope, but potentially take lives rather than give them. Is it any wonder that programmers are looking for ways to simplify their code? And once it works, reuse it in many places? Clearly it isn't. The effects can be too significant in some environments to gamble with the outcomes. That is why a number of programming languages support features like arrays, pointers, and functions.

What Is an Array?

An array is a collection of elements. These elements are ordered, and they are homogeneous, meaning that they are the same. But that similarity is in structure, rather than content. Consider a list of items you might find in a grocery store. Each item would constitute an entry in an array, but each is unique. A box of cereal, as an example, isn't the same as a bar of soap. However, we group them together to work with them as a whole, the list. And we access each item by its position in the list, its index.

What Is a Pointer?

A pointer is a memory location that provides access to another unique memory location. It is this indirect referencing that is at the heart of the feature. Think of it like a road sign. But rather than containing the information you want, it says instead that you can find your information in this other location. It is one of the most misunderstood concepts in computer science, and one of the most powerful. A physical memory location that contains the address of another physical memory location. And through the first memory location, you can make changes to the contents of the second memory location. Powerful, indeed!

What Is a Function?

A function is a group of programming statements that perform a specific operation or task. They are similar to methods, procedures, and modules, in this respect. A function's uniqueness comes from the fact that it returns a value. That value is the point of the function. In other words, the function exists to determine the return value. A function can take input values into itself, called parameters, and return values to the calling program through its return value, or by updating its parameters. Functions support the programming idea of modularity, or the ability to break down complex tasks into simpler ones that can be reused.

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

Register to view this lesson

Are you a student or a teacher?

Unlock Your Education

See for yourself why 30 million people use Study.com

Become a Study.com member and start learning now.
Become a Member  Back
What teachers are saying about Study.com
Try it risk-free for 30 days

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.

To learn more, visit our Earning Credit Page

Transferring credit to the school of your choice

Not sure what college you want to attend yet? Study.com has thousands of articles about every imaginable degree, area of study and career path that can help you find the school that's right for you.

Create an account to start this course today
Try it risk-free for 30 days!
Create an account
Support