0
#include <stdio.h>
    int main()
    {
        int i = 11;
        int *p = &i;
        foo(&p);
        printf("%d ", *p);
    }
    void foo(int *const *p)
    {
        int j = 10;
        *p = &j;
        printf("%d ", **p);
    }

How The Parameters in the FOO function manipulated , are int* const* and int**const same thing ?

  • 1
    Does this answer your question? [What is the difference between const int\*, const int \* const, and int const \*?](https://stackoverflow.com/questions/1143262/what-is-the-difference-between-const-int-const-int-const-and-int-const) – Arnie97 Feb 02 '20 at 16:22

1 Answers1

0

This can help you in the answer : Clockwise/Spiral Rule

Then the following are some examples to explain the concept of const and pointers:

int* - pointer to int
int const * - pointer to const int
int * const - const pointer to int
int const * const - const pointer to const int

Now the first const can be on either side of the type so:

const int * == int const *
const int * const == int const * const

If you want to go far ahead you can do things like this:

int ** - pointer to pointer to int
int ** const - a const pointer to a pointer to an int //THIS IS YOUR CASE
int * const * - a pointer to a const pointer to an int //THIS IS YOUR CASE
int const ** - a pointer to a pointer to a const int
int * const * const - a const pointer to a const pointer to an int
Zig Razor
  • 3,381
  • 2
  • 15
  • 35