Addition

Learn to perform addition on pointers.

Introduction

We’ll learn how to perform addition using pointers. To learn how these operations work, we’ll create variables and pointers to those variables. Then, we will print the pointer variable before and after operating on it.

Recall that memory addresses are printed in hex usually. However, in this chapter, we’ll print them in base 10 to make it easier for us to see the changes.

Increment

In the following code, we create a pointer to a char and increment it. We want to see how the address stored inside the pointer changes.

Get hands-on with 1400+ tech skills courses.