Qualcomm interview question

given the code in C, it involve double pointers, and you have to dereference the double pointer. How is the double pointer going to look like in main memory.

Interview Answer

Anonymous

23 Mar 2015

int **p; int *ptr; suppose ptr is at address ox700 int a= 2 ; // Suppose a is at adrress 0x2001 in stack memory ptr = &a; // Ptr values is now 0x2001 and if we dereference the ptr variable *ptr -> then it will have data 2 p = &ptr; // p will have value 0x700 and if we do single dereference p variable *p -> then it will have data 0x2001 **p will dereference the address 0x2001 to point at value 2

3