Explain Pointers to Pointers with example

Explain Pointers to Pointers  with example

We introduced the concept of a pointer to a pointer previously. You can have a pointer to a pointer of any type.
Consider the following:
char ch;  /* a character */
char *pch; /* a pointer to a character */
char **ppch; /* a pointer to a pointer to a character */
We can visualise this in  following Figure. Here we can see that **ppch refers to memory address of *pch which refers to the memory address of the variable ch. But what does this mean in practice?
Hurry up guys...
HCL off Campus in Pune 10-11 Dec 2012

I am creating this group for shearing my experience with you so you can get the job.The main preference of any student is JOB. He want the job any how but for that he have to fight with the Interview so i am giving you all the details, Previous year question papers,Latest Pattern, Interview Process of that company whether it is Private or Govt how you crack the interview easily with Aptitude,Reasoning,English, Group Discussion, HR-PI,Technical,GK, All things.
Join Us: http://www.facebook.com/groups/392954594118585/?notif_t=group_r2j
 

Fig. Pointers to pointers Recall that char * refers to a (NULL terminated string. So one common and convenient notion is to declare a pointer to a pointer to a string as in following fig.
 
Fig.  Pointer to String

Taking this one stage further we can have several strings being pointed to by the pointer as in following fig 
 
Fig. Pointer to Several Strings We can refer to individual strings by ppch[0], ppch[1], ..... Thus this is identical to declaring char *ppch[].
One common occurrence of this type is in C command line argument input which we now consider.
 



Labels: