Search⌘ K
AI Features

More Details on Reading Complex Declarations

Explore how to read and understand complex pointer declarations in C by applying a general rule starting from the identifier. This lesson breaks down pointer syntax step-by-step to clarify const pointers and pointer to const variables.

Introduction

We can apply the rule for reading complex declarations to any construct inside the C language.

We can apply it to something as simple as int x.

  1. Start from the identifier x. We read it and get "x is."
  2. We can’t move right.
  3. Move left to int. We read it and get "x is an int."

Particularizing the rule

Remember that when we first learned about pointers, we learned how to read such declarations:

const int* const ptr;

The rule was to always start from the right and go left, reading each keyword. This rule is a ...