Pointers to pointers in c programming language

C pointers to pointers: A pointer is pointing to another pointers is called pointers to pointer.


Examples of pointers to pointers in c:


What will be output if you will execute following code?


#include<stdio.h>

int main(){

int s=2,*r=&s,**q=&r,***p=&q;

printf("%d",p[0][0][0]);
return 0;

}


Output: 2

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

5 comments:

Sophia Right said...

A great post without doubt. The information shared is of top quality which has to get appreciated at all levels.

Manmeet Kaur said...

This comment has been removed by the author.

Khamal Fauzan said...

Superb

Khamal Fauzan said...

Superb

Unknown said...

Tips ini mungkin sedikit membantu anda, perhatikan cara bermain lawan anda, jika lawan anda sering fold dan pada putaran tertentu ia melakukan all-in. Ada kemungkinan kartu yang ia dapatkan adalah kartu bernilai tinggi atau Pair.
asikqq
http://dewaqqq.club/
http://sumoqq.today/
interqq
pionpoker
bandar ceme
freebet tanpa deposit
paito warna terlengkap
syair sgp