Multilevel Pointer [With Explanation] - C Language Programming

Multilevel Pointer [With Explanation] - C Language Programming

Program in C Language to Multilevel Pointer



Click here to open this program in Turbo C++

/**********************************************************
 Statement - Multilevel Pointer [With Explanation]
 Programmer - Vineet Choudhary
 Written For - http://developerinsider.co
 **********************************************************/


#include<stdio.h>
#include<conio.h>

void main(){
    int s=2,*r=&s,**q=&r,***p=&q;
    clrscr();
    
    printf("%d",p[0][0][0]);
    
    getch();
}

/*
 Multilevel Pointer
 -------------------
 A pointer is pointer to another pointer which can be pointer to others pointers and so on is known as multilevel pointers. We can have any level of pointers.
 
 Explanation
 -------------
 As we know p[i] =*(p+i)
 So,
 P[0][0][0]=*(p[0][0]+0)=**p[0]=***p
 Another rule is: *&i=i
 So,
 ***p=*** (&q) =**q=** (&r) =*r=*(&s) =s=2
 */
You've successfully subscribed to Developer Insider
Great! Next, complete checkout for full access to Developer Insider
Welcome back! You've successfully signed in
Success! Your account is fully activated, you now have access to all content.