Uploaded November 2026 | Updated December 2026, 3 hours ago
Learn how to use the const keyword with Double Pointers in C programming and understand how different const qualifications affect Pointer to Pointer declarations.
In this tutorial, we explore how const works with multiple levels of pointers and how to determine which variables and pointer values can be modified.
We begin by reviewing Pointer to Pointer, also known as Double Pointer, in C programming.
Using an Integer Variable named number, we create a Pointer to int named pti and a Pointer to Pointer to int named ppti.
For example:
int number = 10;
int *pti = &number;
int **ppti = &pti;
We explain how pti points to number and how ppti points to pti.
Next, we demonstrate how to access and modify the Integer Variable using its identifier, a Single Pointer, and a Double Pointer.
We also explore how the pointer values stored in pti and ppti can be changed when these pointers are not const-qualified.
After that, we introduce the const keyword.
We create a const-qualified Integer Variable and explain why an ordinary Pointer to int cannot be initialized with its address without discarding the const qualification.
We then introduce Pointer to const int and demonstrate how it provides read-only access to the pointed-to object.
Next, we explore Pointer to Pointer to const int.
For example:
const int number = 10;
const int *pti = &number;
const int **ppti = &pti;
We explain why the Integer Object cannot be modified through pti or ppti, while the pointer variables themselves remain modifiable.
After that, we demonstrate how a Pointer to const int can also point to an ordinary modifiable Integer Variable.
We explain how const restricts modification through the pointer without necessarily making the original Integer Object const-qualified.
Next, we explore Const Pointer to const int.
For example:
int number = 10;
const int *const pti = &number;
const int *const *ppti = &pti;
We explain how this declaration prevents modification of the Integer Object through these pointers and prevents reassignment of pti.
However, ppti itself can still be reassigned because it is not a Const Pointer.
Next, we explore Const Pointer to int and Pointer to Const Pointer to int.
For example:
int number = 10;
int *const pti = &number;
int *const *ppti = &pti;
We demonstrate why the Integer Variable can be modified through both pointers while pti cannot be reassigned.
After that, we discuss how to make the Double Pointer itself a Const Pointer.
For example:
int number = 10;
int *const pti = &number;
int *const *const ppti = &pti;
We explain how const applies independently to the pointer at each level.
Next, we explore Const Pointer to Pointer to int.
For example:
int number = 10;
int *pti = &number;
int **const ppti = &pti;
We demonstrate why ppti cannot be reassigned, while pti and number can still be modified through the appropriate expressions.
Finally, we discuss more complex combinations, including Const Pointer to Const Pointer to const int.
Throughout the tutorial, we explain how to read these declarations and identify which objects can be modified at each level of indirection.
This tutorial helps you understand const with Double Pointers, Pointer to Pointer, Pointer to const, Const Pointer, Multiple Levels of Indirection, and const-qualified Pointer Declarations in C programming.
Our Website
LearningLad.com
Social Media
Facebook facebook.com/LearningLad
Twitter twitter.com/LearningLadEdu
Instagram instagram.com/LearningLadOfficial
Learn how to use the const keyword with Double Pointers in C programming and understand how different const qualifications affect Pointer to Pointer declarations.
In this tutorial, we explore how const works with multiple levels of pointers and how to determine which variables and pointer values can be modified.
We begin by reviewing Pointer to Pointer, also known as Double Pointer, in C programming.
Using an Integer Variable named number, we create a Pointer to int named pti and a Pointer to Pointer to int named ppti.
For example:
int number = 10;
int *pti = &number;
int **ppti = &pti;
We explain how pti points to number and how ppti points to pti.
Next, we demonstrate how to access and modify the Integer Variable using its identifier, a Single Pointer, and a Double Pointer.
We also explore how the pointer values stored in pti and ppti can be changed when these pointers are not const-qualified.
After that, we introduce the const keyword.
We create a const-qualified Integer Variable and explain why an ordinary Pointer to int cannot be initialized with its address without discarding the const qualification.
We then introduce Pointer to const int and demonstrate how it provides read-only access to the pointed-to object.
Next, we explore Pointer to Pointer to const int.
For example:
const int number = 10;
const int *pti = &number;
const int **ppti = &pti;
We explain why the Integer Object cannot be modified through pti or ppti, while the pointer variables themselves remain modifiable.
After that, we demonstrate how a Pointer to const int can also point to an ordinary modifiable Integer Variable.
We explain how const restricts modification through the pointer without necessarily making the original Integer Object const-qualified.
Next, we explore Const Pointer to const int.
For example:
int number = 10;
const int *const pti = &number;
const int *const *ppti = &pti;
We explain how this declaration prevents modification of the Integer Object through these pointers and prevents reassignment of pti.
However, ppti itself can still be reassigned because it is not a Const Pointer.
Next, we explore Const Pointer to int and Pointer to Const Pointer to int.
For example:
int number = 10;
int *const pti = &number;
int *const *ppti = &pti;
We demonstrate why the Integer Variable can be modified through both pointers while pti cannot be reassigned.
After that, we discuss how to make the Double Pointer itself a Const Pointer.
For example:
int number = 10;
int *const pti = &number;
int *const *const ppti = &pti;
We explain how const applies independently to the pointer at each level.
Next, we explore Const Pointer to Pointer to int.
For example:
int number = 10;
int *pti = &number;
int **const ppti = &pti;
We demonstrate why ppti cannot be reassigned, while pti and number can still be modified through the appropriate expressions.
Finally, we discuss more complex combinations, including Const Pointer to Const Pointer to const int.
Throughout the tutorial, we explain how to read these declarations and identify which objects can be modified at each level of indirection.
This tutorial helps you understand const with Double Pointers, Pointer to Pointer, Pointer to const, Const Pointer, Multiple Levels of Indirection, and const-qualified Pointer Declarations in C programming.
Our Website
LearningLad.com
Social Media
Facebook facebook.com/LearningLad
Twitter twitter.com/LearningLadEdu
Instagram instagram.com/LearningLadOfficial






![String Literals in C Explained | Memory Storage, Pointers & Undefined Behavior
Learn how String Literals work in C programming, where they are stored in memory, how to create pointers to them, and why modifying a String Literal causes Undefined Behavior.
In this beginner-friendly tutorial, we explore the relationship between String Literals, Character Arrays, Pointers, and Memory Storage in C.
We begin by reviewing how Character Arrays can be initialized using String Literals such as hello and world.
Next, we explain what a String Literal is in C programming.
A String Literal is a sequence of characters enclosed in double quotation marks. We also discuss how the Null Terminator (0) is included at the end of the character sequence.
For example, the String Literal hello contains five visible characters and requires six array elements, including the Null Terminator.
After that, we explore where String Literals are stored in memory.
We explain how String Literals form part of the program data and discuss how they are represented in an executable program.
Using a conceptual Process Memory Layout, we review the Code or Text Region, Data and BSS Regions, Heap, and Stack.
We then explain how String Literals have Static Storage Duration and remain available throughout the entire execution of the program.
We also discuss why the exact memory region used to store String Literals depends on the compiler and implementation.
Next, we compare Character Arrays initialized with String Literals and Pointers that directly refer to String Literals.
For example:
char text[] = hello;
const char *ptr = world;
We explain how text is a separate modifiable Character Array, while ptr points to the first character of a String Literal.
We demonstrate how modifying an element of text changes the Character Array without modifying the original String Literal.
After that, we discuss why String Literals must not be modified in C programming.
Even though C permits a String Literal to initialize a char * pointer, attempting to modify the String Literal through that pointer results in Undefined Behavior.
We explain why using const char * is a better practice when working with String Literals.
Next, we compare Pointer to const and Const Pointer declarations.
We explore how const char *ptr provides read-only access through the pointer, while const char *const ptr also prevents the pointer variable from being reassigned.
After that, we demonstrate how to return a String Literal from a function.
We create a get_message() function that returns const char * and explain why returning a pointer to a String Literal is valid because String Literals have Static Storage Duration.
Finally, we explore what happens when the same String Literal appears multiple times in a C program.
Using two pointers initialized with hello, we display their pointer values using printf() and the %p Format Specifier.
We discuss String Literal Pooling and explain why identical String Literals may share the same memory location or may be stored separately, depending on the implementation.
This tutorial helps you understand String Literals, Static Storage Duration, Character Arrays, Pointers to String Literals, const char *, Undefined Behavior, Process Memory Layout, and String Literal Pooling in C programming.
Our Website
https://www.LearningLad.com
Social Media
Facebook https://www.facebook.com/LearningLad
Twitter https://www.twitter.com/LearningLadEdu
Instagram https://www.instagram.com/LearningLadOfficial String Literals in C Explained | Memory Storage, Pointers & Undefined Behavior](https://i.ytimg.com/vi/UPAqzQNm5bg/mqdefault.jpg)



