Units

### Unit: Pointers To Pointers - Questions and Answers

Practice these Pointers To Pointers under C Programming walk-in interview Questions/ examination questions with best tricks and short cuts with solution. Student (candidate) who want to crack the walk in interview, competitive exams and want to find short cuts and tricks to solve questions on Pointers To Pointers for following purpose.

– Anyone who is wishing to increase their perfect knowledge of Pointers To Pointers of C Programming.
– Anyone who is preparing for aptitude test and increase his in depth aptitude knowledge C Programming specifically Pointers To Pointers.
– Anyone who is preparing for interviews (competitive examinations, govt examinations and bank examinations, off-campus or on campus interviews, walk-in interview and company interviews) having questions on Pointers To Pointers under C Programming.

– Anyone who is preparing for aptitude test or competitive exam or entrance exam.
– Anyone who is preparing for entrance examinations and other competitive examinations.
– All Experienced, Freshers and Students.

Here is list of Questions and Answers covering all key area of  Pointers To Pointers topic of C Programming:

1.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    int main()`
3. `    {`
4. `        int a = 1, b = 2, c = 3;`
5. `        int *ptr1 = &a, *ptr2 = &b, *ptr3 = &c;`
6. `        int **sptr = &ptr1; //-Ref`
7. `        *sptr = ptr2;`
8. `    }`

Explanation:

2.

Comment on the output of this C code?

1. `    #include <stdio.h>`
2. `    int main()`
3. `    {`
4. `        int a = 10;`
5. `        int **c -= &&a;`
6. `    }`

Explanation:

3.

Which of the following declaration throw run-time error?

Explanation:

4.

What substitution should be made to //-Ref such that ptr1 points to variable C?

1. `    #include <stdio.h>`
2. `    int main()`
3. `    {`
4. `        int a = 1, b = 2, c = 3;`
5. `        int *ptr1 = &a;`
6. `        int **sptr = &ptr1;`
7. `        //-Ref`
8. `    }`

Explanation:

5.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    void main()`
3. `    {`
4. `        int a[3] = {1, 2, 3};`
5. `        int *p = a;`
6. `        int **r = &p;`
7. `        printf("%p %p", *r, a);`
8. `    }`

Explanation:

6.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    void main()`
3. `    {`
4. `        int k = 5;`
5. `        int *p = &k;`
6. `        int **m  = &p;`
7. `        **m = 6;`
8. `        printf("%d\n", k);`
9. `    }`

Explanation:

7.

How many number of pointer (*) does C have against a pointer variable declaration?

Explanation:

8.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    void main()`
3. `    {`
4. `        int a[3] = {1, 2, 3};`
5. `        int *p = a;`
6. `        int *r = &p;`
7. `        printf("%d", (**r));`
8. `    }`

Explanation:

9.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    void main()`
3. `    {`
4. `        int k = 5;`
5. `        int *p = &k;`
6. `        int **m  = &p;`
7. `        printf("%d%d%d\n", k, *p, **p);`
8. `    }`

Explanation:

10.

What is the output of this C code?

1. `    #include <stdio.h>`
2. `    void main()`
3. `    {`
4. `        int k = 5;`
5. `        int *p = &k;`
6. `        int **m  = &p;`
7. `        printf("%d%d%d\n", k, *p, **m);`
8. `    }`