I have two declare of pointer:

Pointer *a,*b,*c;
int i=5;
*b=i;
a=b;
c=&b;

at line (a=b) mean a will point to what b point (mean point to int i)
at line (c=&b) mean c will have address of b, mean c will be pointer to pointer b. So, does it same with

Pointer** c=b;

Some of the pointer acknowledge I don't sure. so who help me, please.

thanks :)

Edited 5 Years Ago by hqt: n/a

Hi hqt,
I must say, your English is, well, mmmmh, messy? but I'm sure you'll understand this.
A pointer is a variable like any other and so it needs a type. A pointer points to the memory location of another variable of the same type.

int *a,*b,*c,i=5;
b=&i;//b is a pointer to the memory location of integer i
a=b;//a is assigned the value of b which in this case is the memory location of integer i. So the value printed out will be the same as the value printed out by b.
c=&b;//c is pointing to the memory location of pointer b. A pointer to a pointer.
printf("%d\n%d\n%d\n%d\n",b,a,c,i);

Regards.

:) I know my english is very bad :D (I try to learn so much, but still have no progress)
I have some different idea with you. in line

c=&b;

It seems that c will be pointer to pointer. But I don't think so, because some property of pointer to pointer that c doesn't have.
for example:

struct list{
int info;
struct list* next;
};
int main(){
   struct list* head=Build(); //build a linked list;
   struct list *a,*b,**c;
   a=head; //point to what head point;
   b=&a; //look like pointer to pointer
   c=&a; //point to pointer a
   printf("%d\n",(*c)->info);//---->right
   printf("%d\n",(*b)->info);//---->error

So, I don't think with this declare, c will be pointer to pointer :)

Edited 5 Years Ago by hqt: n/a

c is a pointer that point to a palace of memory and it self have address in memory.The content of the c is address of *c and content of *c is **c address.when you declare c= &a it means that the content of c is address of a pointer that itself refer to another pointer named head so it will work

c content = address of a
*c content = address of where a is pointing (head in this case)
**c content = content of head

but when you declare
b= &a you set content of b as address of a but really there is not reserved place in memory for **c it will not work.

c content = address of a
*c content = address of where a is pointing (head in this case)
**c content = no such memory
This article has been dead for over six months. Start a new discussion instead.