- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
What is the difference between const int*, const int * const, and int const *?
Here we will see some different types of variable declaration based on integer pointers integer constants and the integer constant pointers.
To determine them we will use the Clockwise/Spiral Rule. By discussing the terms, we can understand the rules also.
The const int *. This is used to tell the compiler that this is a pointer type variable, and this can store address of some constant int. The Clock rule is saying like this −
Now the another one is const int * const. This is used to denote that this is one constant pointer variable, which can store the address of another constant integer. The clock rule can be applied, and we can get the statement like below −
The third one is int const*. This is used to denote the variable is a pointer type variable, and this can point to one constant int. The clock rule can be applied like below.
If you notice, you can understand that the first one and the last one, (const int * and the int const *) are same. So we can use them interchangeably.
- Related Articles
- Difference between const int*, const int * const, and int const * in C
- Difference between const int*, const int * const, and int const * in C/C++?
- What is difference between int and const int& in C/C++?
- Difference between const char* p, char * const p, and const char * const p in C
- Difference between #define and const in C
- Difference Between Static and Const in JavaScript
- Difference between #define and const in Arduino
- What is the difference between "const" and "val" in Kotlin?
- JavaScript Const
- What is the difference between keywords const and readonly in C#?
- What is the difference between #define and const Keyword in C++?
- Difference between readonly and const keyword in C#
- Explain the difference between const and readonly keywords in C#
- What is the const Keyword in C++?
- Const Qualifier in C
